From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 13 Jul 2010 14:57:40 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ef2d358-ead6-11e9-9d60-3106f5b1d025 patch: /n/dump/2010/0713/sys/src/cmd/acme/regx.c:20,26 - regx.c:20,26 typedef struct Inst Inst; struct Inst { - uint type; /* < 0x10000 ==> literal, otherwise action */ + uint type; /* < 0x1000000 ==> literal, otherwise action */ union { int sid; int subid; /n/dump/2010/0713/sys/src/cmd/acme/regx.c:61,85 - regx.c:61,85 * 0x100xx are operators, value == precedence * 0x200xx are tokens, i.e. operands for operators */ - #define OPERATOR 0x10000 /* Bitmask of all operators */ - #define START 0x10000 /* Start, used for marker on stack */ - #define RBRA 0x10001 /* Right bracket, ) */ - #define LBRA 0x10002 /* Left bracket, ( */ - #define OR 0x10003 /* Alternation, | */ - #define CAT 0x10004 /* Concatentation, implicit operator */ - #define STAR 0x10005 /* Closure, * */ - #define PLUS 0x10006 /* a+ == aa* */ - #define QUEST 0x10007 /* a? == a|nothing, i.e. 0 or 1 a's */ - #define ANY 0x20000 /* Any character but newline, . */ - #define NOP 0x20001 /* No operation, internal use only */ - #define BOL 0x20002 /* Beginning of line, ^ */ - #define EOL 0x20003 /* End of line, $ */ - #define CCLASS 0x20004 /* Character class, [] */ - #define NCCLASS 0x20005 /* Negated character class, [^] */ - #define END 0x20077 /* Terminate: match found */ + #define OPERATOR 0x1000000 /* Bitmask of all operators */ + #define START 0x1000000 /* Start, used for marker on stack */ + #define RBRA 0x1000001 /* Right bracket, ) */ + #define LBRA 0x1000002 /* Left bracket, ( */ + #define OR 0x1000003 /* Alternation, | */ + #define CAT 0x1000004 /* Concatentation, implicit operator */ + #define STAR 0x1000005 /* Closure, * */ + #define PLUS 0x1000006 /* a+ == aa* */ + #define QUEST 0x1000007 /* a? == a|nothing, i.e. 0 or 1 a's */ + #define ANY 0x2000000 /* Any character but newline, . */ + #define NOP 0x2000001 /* No operation, internal use only */ + #define BOL 0x2000002 /* Beginning of line, ^ */ + #define EOL 0x2000003 /* End of line, $ */ + #define CCLASS 0x2000004 /* Character class, [] */ + #define NCCLASS 0x2000005 /* Negated character class, [^] */ + #define END 0x2000077 /* Terminate: match found */ - #define ISATOR 0x10000 - #define ISAND 0x20000 + #define ISATOR 0x1000000 + #define ISAND 0x2000000 /* * Parser Information /n/dump/2010/0713/sys/src/cmd/acme/regx.c:452,458 - regx.c:452,458 exprp++; return '\n'; } - return *exprp++|0x10000; + return *exprp++|0x1000000; } return *exprp++; } /n/dump/2010/0713/sys/src/cmd/acme/regx.c:492,498 - regx.c:492,498 classp[n+2] = c2; n += 3; }else - classp[n++] = c1; + classp[n++] = c1 & ~0x1000000; } classp[n] = 0; if(nclass == Nclass){