/* XXX? Should be exp2? */
unsigned int l2 = RegExp_fixedLength(r->d.AltCatOp.exp1);
if(l1 != l2 || l1 == ~0u)
- return ~0;
+ return ~0u;
return l1;
}
if((l1 = RegExp_fixedLength(r->d.AltCatOp.exp1)) != ~0u )
if((l2 = RegExp_fixedLength(r->d.AltCatOp.exp2)) != ~0u)
return l1+l2;
- return ~0;
+ return ~0u;
}
unsigned int
case CATOP:
return CatOp_fixedLength(r);
default:
- return ~0;
+ return ~0u;
}
- return ~0;
+ return ~0u;
}
void
return RegExp_new_MatchOp(r);
}
+RegExp *invToRE(SubStr s)
+{
+ RegExp *any, *ran, *inv;
+ SubStr *ss;
+
+
+ s.len--;
+ s.str++;
+
+ ss = SubStr_new("[\\000-\\377]", strlen("[\\000-\\377]"));
+ any = ranToRE(*ss);
+ free(ss);
+ if (s.len <= 2)
+ return any;
+
+ ran = ranToRE(s);
+ inv = mkDiff(any, ran);
+
+ free(ran);
+ free(any);
+
+ return inv;
+}
+
+RegExp *mkDot()
+{
+ SubStr *ss = SubStr_new("[\\000-\\377]", strlen("[\\000-\\377]"));
+ RegExp * any = ranToRE(*ss);
+ RegExp * ran = matchChar('\n');
+ RegExp * inv = mkDiff(any, ran);
+
+ free(ss);
+ free(ran);
+ free(any);
+
+ return inv;
+}
+
RegExp *
RegExp_new_RuleOp(RegExp *e, RegExp *c, Token *t, unsigned int a)
{
+++ /dev/null
-
-
-
-RE2C(1) RE2C(1)
-
-
-N\bNA\bAM\bME\bE
- re2c - convert regular expressions to C/C++
-
-
-S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
- r\bre\be2\b2c\bc [-\b-e\bes\bsb\bb] _\bn_\ba_\bm_\be
-
-
-D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
- r\bre\be2\b2c\bc is a preprocessor that generates C-based recognizers
- from regular expressions. The input to r\bre\be2\b2c\bc consists of
- C/C++ source interleaved with comments of the form /\b/*\b*!\b!r\bre\be2\b2c\bc
- ... *\b*/\b/ which contain scanner specifications. In the out-
- put these comments are replaced with code that, when exe-
- cuted, will find the next input token and then execute
- some user-supplied token-specific code.
-
- For example, given the following code
-
- #define NULL ((char*) 0)
- char *scan(char *p){
- char *q;
- #define YYCTYPE char
- #define YYCURSOR p
- #define YYLIMIT p
- #define YYMARKER q
- #define YYFILL(n)
- /*!re2c
- [0-9]+ {return YYCURSOR;}
- [\000-\377] {return NULL;}
- */
- }
-
- r\bre\be2\b2c\bc will generate
-
- /* Generated by re2c on Sat Apr 16 11:40:58 1994 */
- #line 1 "simple.re"
- #define NULL ((char*) 0)
- char *scan(char *p){
- char *q;
- #define YYCTYPE char
- #define YYCURSOR p
- #define YYLIMIT p
- #define YYMARKER q
- #define YYFILL(n)
- {
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
- yy1: ++YYCURSOR;
- yy0:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '/') goto yy4;
-
-
-
-Version 0.5 8 April 1994 1
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- if(yych >= ':') goto yy4;
- yy2: yych = *++YYCURSOR;
- goto yy7;
- yy3:
- #line 10
- {return YYCURSOR;}
- yy4: yych = *++YYCURSOR;
- yy5:
- #line 11
- {return NULL;}
- yy6: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- yy7: if(yych <= '/') goto yy3;
- if(yych <= '9') goto yy6;
- goto yy3;
- }
- #line 12
-
- }
-
-
-O\bOP\bPT\bTI\bIO\bON\bNS\bS
- r\bre\be2\b2c\bc provides the following options:
-
- -\b-e\be Cross-compile from an ASCII platform to an EBCDIC
- one.
-
- -\b-s\bs Generate nested i\bif\bfs for some s\bsw\bwi\bit\btc\bch\bhes. Many com-
- pilers need this assist to generate better code.
-
- -\b-b\bb Implies -\b-s\bs. Use bit vectors as well in the attempt
- to coax better code out of the compiler. Most use-
- ful for specifications with more than a few key-
- words (e.g. for most programming languages).
-
-
-I\bIN\bNT\bTE\bER\bRF\bFA\bAC\bCE\bE C\bCO\bOD\bDE\bE
- Unlike other scanner generators, r\bre\be2\b2c\bc does not generate
- complete scanners: the user must supply some interface
- code. In particular, the user must define the following
- macros:
-
- Y\bYY\bYC\bCH\bHA\bAR\bR Type used to hold an input symbol. Usually c\bch\bha\bar\br or
- u\bun\bns\bsi\big\bgn\bne\bed\bd c\bch\bha\bar\br.
-
- Y\bYY\bYC\bCU\bUR\bRS\bSO\bOR\bR
- _\bl-expression of type *\b*Y\bYY\bYC\bCH\bHA\bAR\bR that points to the
- current input symbol. The generated code advances
- Y\bYY\bYC\bCU\bUR\bRS\bSO\bOR\bR as symbols are matched. On entry, Y\bYY\bYC\bCU\bUR\bR-\b-
- S\bSO\bOR\bR is assumed to point to the first character of
- the current token. On exit, Y\bYY\bYC\bCU\bUR\bRS\bSO\bOR\bR will point to
- the first character of the following token.
-
-
-
-
-Version 0.5 8 April 1994 2
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- Y\bYL\bLI\bIM\bMI\bIT\bT Expression of type *\b*Y\bYY\bYC\bCH\bHA\bAR\bR that marks the end of
- the buffer (Y\bYL\bLI\bIM\bMI\bIT\bT[\b[-\b-1\b1]\b] is the last character in the
- buffer). The generated code repeatedly compares
- Y\bYY\bYC\bCU\bUR\bRS\bSO\bOR\bR to Y\bYL\bLI\bIM\bMI\bIT\bT to determine when the buffer
- needs (re)filling.
-
- Y\bYY\bYM\bMA\bAR\bRK\bKE\bER\bR
- _\bl-expression of type *\b*Y\bYY\bYC\bCH\bHA\bAR\bR. The generated code
- saves backtracking information in Y\bYY\bYM\bMA\bAR\bRK\bKE\bER\bR.
-
- Y\bYY\bYF\bFI\bIL\bLL\bL(\b(_\bn)\b)
- The generated code "calls" Y\bYY\bYF\bFI\bIL\bLL\bL when the buffer
- needs (re)filling: at least _\bn additional charac-
- ters should be provided. Y\bYY\bYF\bFI\bIL\bLL\bL should adjust
- Y\bYY\bYC\bCU\bUR\bRS\bSO\bOR\bR, Y\bYY\bYL\bLI\bIM\bMI\bIT\bT and Y\bYY\bYM\bMA\bAR\bRK\bKE\bER\bR as needed. Note
- that for typical programming languages _\bn will be
- the length of the longest keyword plus one.
-
-
-S\bSC\bCA\bAN\bNN\bNE\bER\bR S\bSP\bPE\bEC\bCI\bIF\bFI\bIC\bCA\bAT\bTI\bIO\bON\bNS\bS
- Each scanner specification consists of a set of _\br_\bu_\bl_\be_\bs and
- name definitions. Rules consist of a regular expression
- along with a block of C/C++ code that is to be executed
- when the associated regular expression is matched. Name
- definitions are of the form ``_\bn_\ba_\bm_\be =\b= _\br_\be_\bg_\bu_\bl_\ba_\br _\be_\bx_\bp_\br_\be_\bs_\b-
- _\bs_\bi_\bo_\bn;\b;''.
-
-
-S\bSU\bUM\bMM\bMA\bAR\bRY\bY O\bOF\bF R\bRE\bE2\b2C\bC R\bRE\bEG\bGU\bUL\bLA\bAR\bR E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS
- "\b"f\bfo\boo\bo"\b" the literal string f\bfo\boo\bo. ANSI-C escape sequences
- can be used.
-
- [\b[x\bxy\byz\bz]\b] a "character class"; in this case, the regular
- expression matches either an 'x\bx', a 'y\by', or a 'z\bz'.
-
- [\b[a\bab\bbj\bj-\b-o\boZ\bZ]\b]
- a "character class" with a range in it; matches an
- 'a\ba', a 'b\bb', any letter from 'j\bj' through 'o\bo', or a
- 'Z\bZ'.
-
- _\br\\b\_\bs match any _\br which isn't an _\bs. _\br and _\bs must be regu-
- lar expressions which can be expressed as character
- classes.
-
- _\br*\b* zero or more _\br's, where _\br is any regular expression
-
- _\br+\b+ one or more _\br's
-
- _\br?\b? zero or one _\br's (that is, "an optional _\br")
-
- name the expansion of the "name" definition (see above)
-
- (\b(_\br)\b) an _\br; parentheses are used to override precedence
- (see below)
-
-
-
-Version 0.5 8 April 1994 3
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- _\br_\bs an _\br followed by an _\bs ("concatenation")
-
- _\br|\b|_\bs either an _\br or an _\bs
-
- _\br/\b/_\bs an _\br but only if it is followed by an _\bs. The s is
- not part of the matched text. This type of regular
- expression is called "trailing context".
-
- The regular expressions listed above are grouped according
- to precedence, from highest precedence at the top to low-
- est at the bottom. Those grouped together have equal
- precedence.
-
-
-A\bA L\bLA\bAR\bRG\bGE\bER\bR E\bEX\bXA\bAM\bMP\bPL\bLE\bE
- #include <stdlib.h>
- #include <stdio.h>
- #include <fcntl.h>
- #include <string.h>
-
- #define ADDEQ 257
- #define ANDAND 258
- #define ANDEQ 259
- #define ARRAY 260
- #define ASM 261
- #define AUTO 262
- #define BREAK 263
- #define CASE 264
- #define CHAR 265
- #define CONST 266
- #define CONTINUE 267
- #define DECR 268
- #define DEFAULT 269
- #define DEREF 270
- #define DIVEQ 271
- #define DO 272
- #define DOUBLE 273
- #define ELLIPSIS 274
- #define ELSE 275
- #define ENUM 276
- #define EQL 277
- #define EXTERN 278
- #define FCON 279
- #define FLOAT 280
- #define FOR 281
- #define FUNCTION 282
- #define GEQ 283
- #define GOTO 284
- #define ICON 285
- #define ID 286
- #define IF 287
- #define INCR 288
- #define INT 289
- #define LEQ 290
-
-
-
-Version 0.5 8 April 1994 4
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- #define LONG 291
- #define LSHIFT 292
- #define LSHIFTEQ 293
- #define MODEQ 294
- #define MULEQ 295
- #define NEQ 296
- #define OREQ 297
- #define OROR 298
- #define POINTER 299
- #define REGISTER 300
- #define RETURN 301
- #define RSHIFT 302
- #define RSHIFTEQ 303
- #define SCON 304
- #define SHORT 305
- #define SIGNED 306
- #define SIZEOF 307
- #define STATIC 308
- #define STRUCT 309
- #define SUBEQ 310
- #define SWITCH 311
- #define TYPEDEF 312
- #define UNION 313
- #define UNSIGNED 314
- #define VOID 315
- #define VOLATILE 316
- #define WHILE 317
- #define XOREQ 318
- #define EOI 319
-
- typedef unsigned int uint;
- typedef unsigned char uchar;
-
- #define BSIZE 8192
-
- #define YYCTYPE uchar
- #define YYCURSOR cursor
- #define YYLIMIT s->lim
- #define YYMARKER s->ptr
- #define YYFILL(n) {cursor = fill(s, cursor);}
-
- #define RET(i) {s->cur = cursor; return i;}
-
- typedef struct Scanner {
- int fd;
- uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof;
- uint line;
- } Scanner;
-
- uchar *fill(Scanner *s, uchar *cursor){
- if(!s->eof){
- uint cnt = s->tok - s->bot;
- if(cnt){
- memcpy(s->bot, s->tok, s->lim - s->tok);
-
-
-
-Version 0.5 8 April 1994 5
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- s->tok = s->bot;
- s->ptr -= cnt;
- cursor -= cnt;
- s->pos -= cnt;
- s->lim -= cnt;
- }
- if((s->top - s->lim) < BSIZE){
- uchar *buf = (uchar*)
- malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
- memcpy(buf, s->tok, s->lim - s->tok);
- s->tok = buf;
- s->ptr = &buf[s->ptr - s->bot];
- cursor = &buf[cursor - s->bot];
- s->pos = &buf[s->pos - s->bot];
- s->lim = &buf[s->lim - s->bot];
- s->top = &s->lim[BSIZE];
- free(s->bot);
- s->bot = buf;
- }
- if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){
- s->eof = &s->lim[cnt]; *(s->eof)++ = '\n';
- }
- s->lim += cnt;
- }
- return cursor;
- }
-
- int scan(Scanner *s){
- uchar *cursor = s->cur;
- std:
- s->tok = cursor;
- /*!re2c
- any = [\000-\377];
- O = [0-7];
- D = [0-9];
- L = [a-zA-Z_];
- H = [a-fA-F0-9];
- E = [Ee] [+-]? D+;
- FS = [fFlL];
- IS = [uUlL]*;
- ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+);
- */
-
- /*!re2c
- "/*" { goto comment; }
-
- "auto" { RET(AUTO); }
- "break" { RET(BREAK); }
- "case" { RET(CASE); }
- "char" { RET(CHAR); }
- "const" { RET(CONST); }
- "continue" { RET(CONTINUE); }
- "default" { RET(DEFAULT); }
- "do" { RET(DO); }
-
-
-
-Version 0.5 8 April 1994 6
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- "double" { RET(DOUBLE); }
- "else" { RET(ELSE); }
- "enum" { RET(ENUM); }
- "extern" { RET(EXTERN); }
- "float" { RET(FLOAT); }
- "for" { RET(FOR); }
- "goto" { RET(GOTO); }
- "if" { RET(IF); }
- "int" { RET(INT); }
- "long" { RET(LONG); }
- "register" { RET(REGISTER); }
- "return" { RET(RETURN); }
- "short" { RET(SHORT); }
- "signed" { RET(SIGNED); }
- "sizeof" { RET(SIZEOF); }
- "static" { RET(STATIC); }
- "struct" { RET(STRUCT); }
- "switch" { RET(SWITCH); }
- "typedef" { RET(TYPEDEF); }
- "union" { RET(UNION); }
- "unsigned" { RET(UNSIGNED); }
- "void" { RET(VOID); }
- "volatile" { RET(VOLATILE); }
- "while" { RET(WHILE); }
-
- L (L|D)* { RET(ID); }
-
- ("0" [xX] H+ IS?) | ("0" D+ IS?) | (D+ IS?) |
- (['] (ESC|any\[\n\\'])* ['])
- { RET(ICON); }
-
- (D+ E FS?) | (D* "." D+ E? FS?) | (D+ "." D* E? FS?)
- { RET(FCON); }
-
- (["] (ESC|any\[\n\\"])* ["])
- { RET(SCON); }
-
- "..." { RET(ELLIPSIS); }
- ">>=" { RET(RSHIFTEQ); }
- "<<=" { RET(LSHIFTEQ); }
- "+=" { RET(ADDEQ); }
- "-=" { RET(SUBEQ); }
- "*=" { RET(MULEQ); }
- "/=" { RET(DIVEQ); }
- "%=" { RET(MODEQ); }
- "&=" { RET(ANDEQ); }
- "^=" { RET(XOREQ); }
- "|=" { RET(OREQ); }
- ">>" { RET(RSHIFT); }
- "<<" { RET(LSHIFT); }
- "++" { RET(INCR); }
- "--" { RET(DECR); }
- "->" { RET(DEREF); }
- "&&" { RET(ANDAND); }
-
-
-
-Version 0.5 8 April 1994 7
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- "||" { RET(OROR); }
- "<=" { RET(LEQ); }
- ">=" { RET(GEQ); }
- "==" { RET(EQL); }
- "!=" { RET(NEQ); }
- ";" { RET(';'); }
- "{" { RET('{'); }
- "}" { RET('}'); }
- "," { RET(','); }
- ":" { RET(':'); }
- "=" { RET('='); }
- "(" { RET('('); }
- ")" { RET(')'); }
- "[" { RET('['); }
- "]" { RET(']'); }
- "." { RET('.'); }
- "&" { RET('&'); }
- "!" { RET('!'); }
- "~" { RET('~'); }
- "-" { RET('-'); }
- "+" { RET('+'); }
- "*" { RET('*'); }
- "/" { RET('/'); }
- "%" { RET('%'); }
- "<" { RET('<'); }
- ">" { RET('>'); }
- "^" { RET('^'); }
- "|" { RET('|'); }
- "?" { RET('?'); }
-
-
- [ \t\v\f]+ { goto std; }
-
- "\n"
- {
- if(cursor == s->eof) RET(EOI);
- s->pos = cursor; s->line++;
- goto std;
- }
-
- any
- {
- printf("unexpected character: %c\n", *s->tok);
- goto std;
- }
- */
-
- comment:
- /*!re2c
- "*/" { goto std; }
- "\n"
- {
- if(cursor == s->eof) RET(EOI);
- s->tok = s->pos = cursor; s->line++;
-
-
-
-Version 0.5 8 April 1994 8
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- goto comment;
- }
- any { goto comment; }
- */
- }
-
- main(){
- Scanner in;
- int t;
- memset((char*) &in, 0, sizeof(in));
- in.fd = 0;
- while((t = scan(&in)) != EOI){
- /*
- printf("%d\t%.*s\n", t, in.cur - in.tok, in.tok);
- printf("%d\n", t);
- */
- }
- close(in.fd);
- }
-
-
-S\bSE\bEE\bE A\bAL\bLS\bSO\bO
- flex(1), lex(1).
-
-
-F\bFE\bEA\bAT\bTU\bUR\bRE\bES\bS
- r\bre\be2\b2c\bc does not provide a default action: the generated code
- assumes that the input will consist of a sequence of
- tokens. Typically this can be dealt with by adding a rule
- such as the one for unexpected characters in the example
- above.
-
- The user must arrange for a sentinel token to appear at
- the end of input (and provide a rule for matching it):
- r\bre\be2\b2c\bc does not provide an <\b<<\b<E\bEO\bOF\bF>\b>>\b> expression. If the
- source is from a null-byte terminated string, a rule
- matching a null character will suffice. If the source is
- from a file then the approach taken in the example can be
- used: pad the input with a newline (or some other charac-
- ter that can't appear within another token); upon recog-
- nizing such a character check to see if it is the sentinel
- and act accordingly.
-
- r\bre\be2\b2c\bc does not provide start conditions: use a separate
- scanner specification for each start condition (as illus-
- trated in the above example).
-
- No [^x]. Use difference instead.
-
-B\bBU\bUG\bGS\bS
- Only fixed length trailing context can be handled.
-
- The maximum value appearing as a parameter _\bn to Y\bYY\bYF\bFI\bIL\bLL\bL is
- not provided to the generated code (this value is needed
-
-
-
-Version 0.5 8 April 1994 9
-
-
-
-
-
-RE2C(1) RE2C(1)
-
-
- for constructing the interface code). Note that this
- value is usually relatively small: for typical programming
- languages _\bn will be the length of the longest keyword plus
- one.
-
- Difference only works for character sets.
-
- The r\bre\be2\b2c\bc internal algorithms need documentation.
-
-
-A\bAU\bUT\bTH\bHO\bOR\bR
- Please send bug reports, fixes and feedback to:
-
- Peter Bumbulis
- Computer Systems Group
- University of Waterloo
- Waterloo, Ontario
- N2L 3G1
- Internet: peterr@csg.uwaterloo.ca
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Version 0.5 8 April 1994 10
-
-
-/* Generated by re2c 0.9.1-C on Thu Aug 14 20:37:33 2003
+/* Generated by re2c 0.9.1-C on Sun Oct 9 15:00:35 2005
*/
#line 1 "scanner.re"
#include <stdlib.h>
#include "tools/re2c/parse.h"
#include "tools/re2c/globals.h"
#include "re2c-parser.h"
+#include "globals.h"
+
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
#define BSIZE 8192
s->bot = buf;
}
if((cnt = fread(s->lim, 1, BSIZE, s->in)) != BSIZE){
- s->eof = &s->lim[cnt]; *s->eof++ = '\n';
+ s->eof = &s->lim[cnt]; *s->eof++ = '\0';
}
s->lim += cnt;
}
return cursor;
}
-#line 75 "scanner.re"
+#line 80 "scanner.re"
int
Scanner_echo(Scanner *s, FILE *out)
{
unsigned char *cursor = s->cur;
+ int ignore_eoc = 0;
/* Catch EOF */
if (s->eof && cursor == s->eof)
s->tok = cursor;
echo:
-#line 85 "scanner.c"
+#line 88 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
++YYCURSOR;
yy0:
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
+ if((YYLIMIT - YYCURSOR) < 11) YYFILL(11);
yych = *YYCURSOR;
- if(yych == '\n') goto yy4;
- if(yych != '/') goto yy6;
- yyaccept = 0;
+ if(yych <= ')'){
+ if(yych <= '\000') goto yy7;
+ if(yych == '\n') goto yy5;
+ goto yy9;
+ } else {
+ if(yych <= '*') goto yy4;
+ if(yych != '/') goto yy9;
+ goto yy2;
+ }
+yy2: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == '*') goto yy7;
+ if(yych == '*') goto yy12;
+ goto yy3;
yy3:
-#line 96 "scanner.re"
+#line 118 "scanner.re"
{ goto echo; }
-#line 102 "scanner.c"
+#line 113 "scanner.c"
yy4: yych = *++YYCURSOR;
-
-#line 92 "scanner.re"
-{ if(cursor == s->eof) RETURN(0);
- fwrite(s->tok, 1, cursor - s->tok, out);
+ if(yych == '/') goto yy10;
+ goto yy3;
+yy5: yych = *++YYCURSOR;
+ goto yy6;
+yy6:
+#line 113 "scanner.re"
+{ fwrite(s->tok, 1, cursor - s->tok, out);
s->tok = s->pos = cursor; s->cline++; oline++;
goto echo; }
-#line 110 "scanner.c"
-yy6: yych = *++YYCURSOR;
- goto yy3;
+#line 124 "scanner.c"
yy7: yych = *++YYCURSOR;
- if(yych == '!') goto yy9;
-yy8: YYCURSOR = YYMARKER;
+ goto yy8;
+yy8:
+#line 116 "scanner.re"
+{ fwrite(s->tok, 1, cursor - s->tok - 1, out); /* -1 so we don't write out the \0 */
+ if(cursor == s->eof) { RETURN(0); } }
+#line 131 "scanner.c"
+yy9: yych = *++YYCURSOR;
+ goto yy3;
+yy10: yych = *++YYCURSOR;
+ goto yy11;
+yy11:
+#line 104 "scanner.re"
+{
+ if (ignore_eoc) {
+ ignore_eoc = 0;
+ } else {
+ fwrite(s->tok, 1, cursor - s->tok, out);
+ }
+ s->tok = s->pos = cursor;
+ goto echo;
+ }
+#line 147 "scanner.c"
+yy12: yych = *++YYCURSOR;
+ if(yych == '!') goto yy14;
+ goto yy13;
+yy13: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy3;
}
-yy9: yych = *++YYCURSOR;
- if(yych != 'r') goto yy8;
- yych = *++YYCURSOR;
- if(yych != 'e') goto yy8;
- yych = *++YYCURSOR;
- if(yych != '2') goto yy8;
- yych = *++YYCURSOR;
- if(yych != 'c') goto yy8;
- yych = *++YYCURSOR;
-
-#line 89 "scanner.re"
+yy14: yych = *++YYCURSOR;
+ if(yych == 'm') goto yy15;
+ if(yych == 'r') goto yy16;
+ goto yy13;
+yy15: yych = *++YYCURSOR;
+ if(yych == 'a') goto yy21;
+ goto yy13;
+yy16: yych = *++YYCURSOR;
+ if(yych != 'e') goto yy13;
+ goto yy17;
+yy17: yych = *++YYCURSOR;
+ if(yych != '2') goto yy13;
+ goto yy18;
+yy18: yych = *++YYCURSOR;
+ if(yych != 'c') goto yy13;
+ goto yy19;
+yy19: yych = *++YYCURSOR;
+ goto yy20;
+yy20:
+#line 95 "scanner.re"
{ fwrite(s->tok, 1, &cursor[-7] - s->tok, out);
s->tok = cursor;
RETURN(1); }
-#line 133 "scanner.c"
+#line 178 "scanner.c"
+yy21: yych = *++YYCURSOR;
+ if(yych != 'x') goto yy13;
+ goto yy22;
+yy22: yych = *++YYCURSOR;
+ if(yych != ':') goto yy13;
+ goto yy23;
+yy23: yych = *++YYCURSOR;
+ if(yych != 'r') goto yy13;
+ goto yy24;
+yy24: yych = *++YYCURSOR;
+ if(yych != 'e') goto yy13;
+ goto yy25;
+yy25: yych = *++YYCURSOR;
+ if(yych != '2') goto yy13;
+ goto yy26;
+yy26: yych = *++YYCURSOR;
+ if(yych != 'c') goto yy13;
+ goto yy27;
+yy27: yych = *++YYCURSOR;
+ goto yy28;
+yy28:
+#line 98 "scanner.re"
+{
+ fprintf(out, "#define YYMAXFILL %u\n", maxFill);
+ s->tok = s->pos = cursor;
+ ignore_eoc = 1;
+ goto echo;
+ }
+#line 207 "scanner.c"
}
-#line 97 "scanner.re"
+#line 119 "scanner.re"
}
s->tline = s->cline;
s->tok = cursor;
-#line 151 "scanner.c"
+#line 225 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy15;
+ goto yy29;
++YYCURSOR;
-yy15:
+yy29:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= ':'){
+ if(yych <= '/'){
if(yych <= '"'){
if(yych <= '\n'){
- if(yych <= '\b') goto yy35;
- if(yych <= '\t') goto yy31;
- goto yy33;
+ if(yych <= '\b') goto yy53;
+ if(yych <= '\t') goto yy47;
+ goto yy49;
} else {
- if(yych == ' ') goto yy31;
- if(yych <= '!') goto yy35;
- goto yy23;
+ if(yych == ' ') goto yy47;
+ if(yych <= '!') goto yy53;
+ goto yy37;
}
} else {
if(yych <= '*'){
- if(yych <= '\'') goto yy35;
- if(yych <= ')') goto yy27;
- goto yy21;
- } else {
- if(yych <= '+') goto yy28;
- if(yych == '/') goto yy19;
+ if(yych <= '&') goto yy53;
+ if(yych <= '\'') goto yy39;
+ if(yych <= ')') goto yy43;
goto yy35;
+ } else {
+ if(yych <= '+') goto yy44;
+ if(yych <= '-') goto yy53;
+ if(yych <= '.') goto yy51;
+ goto yy33;
}
}
} else {
- if(yych <= 'Z'){
- if(yych <= '='){
- if(yych == '<') goto yy35;
- goto yy27;
+ if(yych <= '@'){
+ if(yych <= '<'){
+ if(yych == ';') goto yy43;
+ goto yy53;
} else {
- if(yych == '?') goto yy28;
- if(yych <= '@') goto yy35;
- goto yy29;
+ if(yych <= '=') goto yy43;
+ if(yych == '?') goto yy44;
+ goto yy53;
}
} else {
if(yych <= '`'){
- if(yych <= '[') goto yy25;
- if(yych <= '\\') goto yy27;
- goto yy35;
+ if(yych <= 'Z') goto yy45;
+ if(yych <= '[') goto yy41;
+ if(yych <= '\\') goto yy43;
+ goto yy53;
} else {
- if(yych <= 'z') goto yy29;
- if(yych <= '{') goto yy17;
- if(yych <= '|') goto yy27;
- goto yy35;
+ if(yych <= 'z') goto yy45;
+ if(yych <= '{') goto yy31;
+ if(yych <= '|') goto yy43;
+ goto yy53;
}
}
}
-yy17: yych = *++YYCURSOR;
-
-#line 112 "scanner.re"
+yy31: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if(yych <= '/') goto yy32;
+ if(yych <= '9') goto yy84;
+ goto yy32;
+yy32:
+#line 134 "scanner.re"
{ depth = 1;
goto code;
}
-#line 211 "scanner.c"
-yy19: yych = *++YYCURSOR;
- if(yych == '*') goto yy54;
-yy20:
-#line 131 "scanner.re"
+#line 292 "scanner.c"
+yy33: yych = *++YYCURSOR;
+ if(yych == '*') goto yy82;
+ goto yy34;
+yy34:
+#line 164 "scanner.re"
{ RETURN(*s->tok); }
-#line 217 "scanner.c"
-yy21: yych = *++YYCURSOR;
- if(yych == '/') goto yy52;
-yy22:
-#line 133 "scanner.re"
+#line 299 "scanner.c"
+yy35: yych = *++YYCURSOR;
+ if(yych == '/') goto yy80;
+ goto yy36;
+yy36:
+#line 166 "scanner.re"
{ yylval.op = *s->tok;
RETURN(CLOSE); }
-#line 224 "scanner.c"
-yy23: yyaccept = 0;
+#line 307 "scanner.c"
+yy37: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych != '\n') goto yy48;
-yy24:
-#line 124 "scanner.re"
-{ Scanner_fatal(s, "bad string"); }
-#line 231 "scanner.c"
-yy25: yyaccept = 1;
+ if(yych != '\n') goto yy76;
+ goto yy38;
+yy38:
+#line 151 "scanner.re"
+{ Scanner_fatal(s, "unterminated string constant (missing \")"); }
+#line 315 "scanner.c"
+yy39: yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych != '\n') goto yy42;
-yy26:
-#line 129 "scanner.re"
-{ Scanner_fatal(s, "bad character constant"); }
-#line 238 "scanner.c"
-yy27: yych = *++YYCURSOR;
- goto yy20;
-yy28: yych = *++YYCURSOR;
- goto yy22;
-yy29: yych = *++YYCURSOR;
+ if(yych != '\n') goto yy71;
goto yy40;
-yy30:
-#line 136 "scanner.re"
+yy40:
+#line 152 "scanner.re"
+{ Scanner_fatal(s, "unterminated string constant (missing ')"); }
+#line 323 "scanner.c"
+yy41: yyaccept = 3;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if(yych == '\n') goto yy42;
+ if(yych == '^') goto yy62;
+ goto yy60;
+yy42:
+#line 162 "scanner.re"
+{ Scanner_fatal(s, "unterminated range (missing ])"); }
+#line 332 "scanner.c"
+yy43: yych = *++YYCURSOR;
+ goto yy34;
+yy44: yych = *++YYCURSOR;
+ goto yy36;
+yy45: yych = *++YYCURSOR;
+ goto yy58;
+yy46:
+#line 181 "scanner.re"
{ SubStr substr;
s->cur = cursor;
substr = Scanner_token(s);
yylval.symbol = Symbol_find(&substr);
return ID; }
-#line 252 "scanner.c"
-yy31: yych = *++YYCURSOR;
- goto yy38;
-yy32:
-#line 142 "scanner.re"
+#line 346 "scanner.c"
+yy47: yych = *++YYCURSOR;
+ goto yy56;
+yy48:
+#line 187 "scanner.re"
{ goto scan; }
-#line 258 "scanner.c"
-yy33: yych = *++YYCURSOR;
-
-#line 144 "scanner.re"
+#line 352 "scanner.c"
+yy49: yych = *++YYCURSOR;
+ goto yy50;
+yy50:
+#line 189 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
s->pos = cursor; s->cline++;
goto scan;
}
-#line 266 "scanner.c"
-yy35: yych = *++YYCURSOR;
-
-#line 149 "scanner.re"
+#line 361 "scanner.c"
+yy51: yych = *++YYCURSOR;
+ goto yy52;
+yy52:
+#line 194 "scanner.re"
+{ s->cur = cursor;
+ yylval.regexp = mkDot();
+ return RANGE;
+ }
+#line 370 "scanner.c"
+yy53: yych = *++YYCURSOR;
+ goto yy54;
+yy54:
+#line 199 "scanner.re"
{ fprintf(stderr, "unexpected character: '%c'\n", *s->tok);
goto scan;
}
-#line 273 "scanner.c"
-yy37: ++YYCURSOR;
+#line 378 "scanner.c"
+yy55: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy38: if(yych == '\t') goto yy37;
- if(yych == ' ') goto yy37;
- goto yy32;
-yy39: ++YYCURSOR;
+ goto yy56;
+yy56: if(yych == '\t') goto yy55;
+ if(yych == ' ') goto yy55;
+ goto yy48;
+yy57: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy40: if(yych <= '@'){
- if(yych <= '/') goto yy30;
- if(yych <= '9') goto yy39;
- goto yy30;
+ goto yy58;
+yy58: if(yych <= '@'){
+ if(yych <= '/') goto yy46;
+ if(yych <= '9') goto yy57;
+ goto yy46;
} else {
- if(yych <= 'Z') goto yy39;
- if(yych <= '`') goto yy30;
- if(yych <= 'z') goto yy39;
- goto yy30;
+ if(yych <= 'Z') goto yy57;
+ if(yych <= '`') goto yy46;
+ if(yych <= 'z') goto yy57;
+ goto yy46;
}
-yy41: ++YYCURSOR;
+yy59: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy42: if(yych <= '['){
- if(yych != '\n') goto yy41;
+ goto yy60;
+yy60: if(yych <= '['){
+ if(yych != '\n') goto yy59;
+ goto yy61;
} else {
- if(yych <= '\\') goto yy44;
- if(yych <= ']') goto yy45;
- goto yy41;
+ if(yych <= '\\') goto yy64;
+ if(yych <= ']') goto yy65;
+ goto yy59;
}
-yy43: YYCURSOR = YYMARKER;
+yy61: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy24;
- case 1: goto yy26;
+ case 0: goto yy32;
+ case 1: goto yy38;
+ case 2: goto yy40;
+ case 3: goto yy42;
}
-yy44: ++YYCURSOR;
+yy62: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy43;
- goto yy41;
-yy45: yych = *++YYCURSOR;
-
-#line 126 "scanner.re"
+ goto yy63;
+yy63: if(yych <= '['){
+ if(yych == '\n') goto yy61;
+ goto yy62;
+ } else {
+ if(yych <= '\\') goto yy67;
+ if(yych <= ']') goto yy68;
+ goto yy62;
+ }
+yy64: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if(yych == '\n') goto yy61;
+ goto yy59;
+yy65: yych = *++YYCURSOR;
+ goto yy66;
+yy66:
+#line 158 "scanner.re"
{ s->cur = cursor;
yylval.regexp = ranToRE(Scanner_token(s));
return RANGE; }
-#line 319 "scanner.c"
-yy47: ++YYCURSOR;
+#line 443 "scanner.c"
+yy67: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy48: if(yych <= '!'){
- if(yych == '\n') goto yy43;
- goto yy47;
+ if(yych == '\n') goto yy61;
+ goto yy62;
+yy68: yych = *++YYCURSOR;
+ goto yy69;
+yy69:
+#line 154 "scanner.re"
+{ s->cur = cursor;
+ yylval.regexp = invToRE(Scanner_token(s));
+ return RANGE; }
+#line 456 "scanner.c"
+yy70: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy71;
+yy71: if(yych <= '&'){
+ if(yych == '\n') goto yy61;
+ goto yy70;
} else {
- if(yych <= '"') goto yy50;
- if(yych != '\\') goto yy47;
+ if(yych <= '\'') goto yy73;
+ if(yych != '\\') goto yy70;
+ goto yy72;
}
- ++YYCURSOR;
+yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy43;
- goto yy47;
-yy50: yych = *++YYCURSOR;
-
-#line 121 "scanner.re"
+ if(yych == '\n') goto yy61;
+ goto yy70;
+yy73: yych = *++YYCURSOR;
+ goto yy74;
+yy74:
+#line 147 "scanner.re"
+{ s->cur = cursor;
+ yylval.regexp = strToCaseInsensitiveRE(Scanner_token(s));
+ return STRING; }
+#line 481 "scanner.c"
+yy75: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy76;
+yy76: if(yych <= '!'){
+ if(yych == '\n') goto yy61;
+ goto yy75;
+ } else {
+ if(yych <= '"') goto yy78;
+ if(yych != '\\') goto yy75;
+ goto yy77;
+ }
+yy77: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if(yych == '\n') goto yy61;
+ goto yy75;
+yy78: yych = *++YYCURSOR;
+ goto yy79;
+yy79:
+#line 143 "scanner.re"
{ s->cur = cursor;
yylval.regexp = strToRE(Scanner_token(s));
return STRING; }
-#line 341 "scanner.c"
-yy52: yych = *++YYCURSOR;
-
-#line 118 "scanner.re"
+#line 506 "scanner.c"
+yy80: yych = *++YYCURSOR;
+ goto yy81;
+yy81:
+#line 140 "scanner.re"
{ s->tok = cursor;
RETURN(0); }
-#line 347 "scanner.c"
-yy54: yych = *++YYCURSOR;
-
-#line 115 "scanner.re"
+#line 513 "scanner.c"
+yy82: yych = *++YYCURSOR;
+ goto yy83;
+yy83:
+#line 137 "scanner.re"
{ depth = 1;
goto comment; }
-#line 353 "scanner.c"
+#line 520 "scanner.c"
+yy84: ++YYCURSOR;
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ goto yy85;
+yy85: if(yych <= '/'){
+ if(yych == ',') goto yy88;
+ goto yy61;
+ } else {
+ if(yych <= '9') goto yy84;
+ if(yych != '}') goto yy61;
+ goto yy86;
+ }
+yy86: yych = *++YYCURSOR;
+ goto yy87;
+yy87:
+#line 169 "scanner.re"
+{ yylval.extop.minsize = atoi((char *)s->tok+1);
+ yylval.extop.maxsize = atoi((char *)s->tok+1);
+ RETURN(CLOSESIZE); }
+#line 540 "scanner.c"
+yy88: yych = *++YYCURSOR;
+ if(yych != '}') goto yy92;
+ goto yy89;
+yy89: yych = *++YYCURSOR;
+ goto yy90;
+yy90:
+#line 177 "scanner.re"
+{ yylval.extop.minsize = atoi((char *)s->tok+1);
+ yylval.extop.maxsize = -1;
+ RETURN(CLOSESIZE); }
+#line 551 "scanner.c"
+yy91: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy92;
+yy92: if(yych <= '/') goto yy61;
+ if(yych <= '9') goto yy91;
+ if(yych != '}') goto yy61;
+ goto yy93;
+yy93: yych = *++YYCURSOR;
+ goto yy94;
+yy94:
+#line 173 "scanner.re"
+{ yylval.extop.minsize = atoi((char *)s->tok+1);
+ yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)s->tok, ',')+1));
+ RETURN(CLOSESIZE); }
+#line 567 "scanner.c"
}
-#line 152 "scanner.re"
+#line 202 "scanner.re"
code:
-#line 360 "scanner.c"
+#line 574 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy56;
+ goto yy95;
++YYCURSOR;
-yy56:
+yy95:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= '&'){
if(yych <= '\n'){
- if(yych <= '\t') goto yy64;
- goto yy62;
+ if(yych <= '\t') goto yy103;
+ goto yy101;
} else {
- if(yych == '"') goto yy66;
- goto yy64;
+ if(yych == '"') goto yy105;
+ goto yy103;
}
} else {
if(yych <= '{'){
- if(yych <= '\'') goto yy67;
- if(yych <= 'z') goto yy64;
- goto yy60;
+ if(yych <= '\'') goto yy106;
+ if(yych <= 'z') goto yy103;
+ goto yy99;
} else {
- if(yych != '}') goto yy64;
+ if(yych != '}') goto yy103;
+ goto yy97;
}
}
- yych = *++YYCURSOR;
-
-#line 156 "scanner.re"
+yy97: yych = *++YYCURSOR;
+ goto yy98;
+yy98:
+#line 206 "scanner.re"
{ if(--depth == 0){
s->cur = cursor;
yylval.token = Token_new(Scanner_token(s), s->tline);
return CODE;
}
goto code; }
-#line 395 "scanner.c"
-yy60: yych = *++YYCURSOR;
-
-#line 162 "scanner.re"
+#line 611 "scanner.c"
+yy99: yych = *++YYCURSOR;
+ goto yy100;
+yy100:
+#line 212 "scanner.re"
{ ++depth;
goto code; }
-#line 401 "scanner.c"
-yy62: yych = *++YYCURSOR;
-
-#line 164 "scanner.re"
+#line 618 "scanner.c"
+yy101: yych = *++YYCURSOR;
+ goto yy102;
+yy102:
+#line 214 "scanner.re"
{ if(cursor == s->eof) Scanner_fatal(s, "missing '}'");
s->pos = cursor; s->cline++;
goto code;
}
-#line 409 "scanner.c"
-yy64: yych = *++YYCURSOR;
-yy65:
-#line 168 "scanner.re"
+#line 627 "scanner.c"
+yy103: yych = *++YYCURSOR;
+ goto yy104;
+yy104:
+#line 218 "scanner.re"
{ goto code; }
-#line 414 "scanner.c"
-yy66: yyaccept = 0;
+#line 633 "scanner.c"
+yy105: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == '\n') goto yy65;
- goto yy73;
-yy67: yyaccept = 0;
+ if(yych == '\n') goto yy104;
+ goto yy112;
+yy106: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == '\n') goto yy65;
- goto yy69;
-yy68: ++YYCURSOR;
+ if(yych == '\n') goto yy104;
+ goto yy108;
+yy107: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy69: if(yych <= '&'){
- if(yych != '\n') goto yy68;
+ goto yy108;
+yy108: if(yych <= '&'){
+ if(yych != '\n') goto yy107;
+ goto yy109;
} else {
- if(yych <= '\'') goto yy64;
- if(yych == '\\') goto yy71;
- goto yy68;
+ if(yych <= '\'') goto yy103;
+ if(yych == '\\') goto yy110;
+ goto yy107;
}
-yy70: YYCURSOR = YYMARKER;
+yy109: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy65;
+ case 0: goto yy104;
}
-yy71: ++YYCURSOR;
+yy110: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy70;
- goto yy68;
-yy72: ++YYCURSOR;
+ if(yych == '\n') goto yy109;
+ goto yy107;
+yy111: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy73: if(yych <= '!'){
- if(yych == '\n') goto yy70;
- goto yy72;
+ goto yy112;
+yy112: if(yych <= '!'){
+ if(yych == '\n') goto yy109;
+ goto yy111;
} else {
- if(yych <= '"') goto yy64;
- if(yych != '\\') goto yy72;
+ if(yych <= '"') goto yy103;
+ if(yych != '\\') goto yy111;
+ goto yy113;
}
- ++YYCURSOR;
+yy113: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy70;
- goto yy72;
+ if(yych == '\n') goto yy109;
+ goto yy111;
}
-#line 169 "scanner.re"
+#line 219 "scanner.re"
comment:
-#line 463 "scanner.c"
+#line 686 "scanner.c"
{
YYCTYPE yych;
- unsigned int yyaccept;
- goto yy75;
+ goto yy114;
++YYCURSOR;
-yy75:
+yy114:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= ')'){
- if(yych == '\n') goto yy80;
- goto yy82;
+ if(yych == '\n') goto yy119;
+ goto yy121;
} else {
- if(yych <= '*') goto yy77;
- if(yych == '/') goto yy79;
- goto yy82;
+ if(yych <= '*') goto yy116;
+ if(yych == '/') goto yy118;
+ goto yy121;
}
-yy77: yych = *++YYCURSOR;
- if(yych == '/') goto yy85;
-yy78:
-#line 183 "scanner.re"
+yy116: yych = *++YYCURSOR;
+ if(yych == '/') goto yy124;
+ goto yy117;
+yy117:
+#line 233 "scanner.re"
{ goto comment; }
-#line 485 "scanner.c"
-yy79: yych = *++YYCURSOR;
- if(yych == '*') goto yy83;
- goto yy78;
-yy80: yych = *++YYCURSOR;
-
-#line 179 "scanner.re"
+#line 708 "scanner.c"
+yy118: yych = *++YYCURSOR;
+ if(yych == '*') goto yy122;
+ goto yy117;
+yy119: yych = *++YYCURSOR;
+ goto yy120;
+yy120:
+#line 229 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
s->tok = s->pos = cursor; s->cline++;
goto comment;
}
-#line 496 "scanner.c"
-yy82: yych = *++YYCURSOR;
- goto yy78;
-yy83: yych = *++YYCURSOR;
-
-#line 177 "scanner.re"
+#line 720 "scanner.c"
+yy121: yych = *++YYCURSOR;
+ goto yy117;
+yy122: yych = *++YYCURSOR;
+ goto yy123;
+yy123:
+#line 227 "scanner.re"
{ ++depth;
goto comment; }
-#line 504 "scanner.c"
-yy85: yych = *++YYCURSOR;
-
-#line 173 "scanner.re"
+#line 729 "scanner.c"
+yy124: yych = *++YYCURSOR;
+ goto yy125;
+yy125:
+#line 223 "scanner.re"
{ if(--depth == 0)
goto scan;
else
goto comment; }
-#line 512 "scanner.c"
+#line 738 "scanner.c"
}
-#line 184 "scanner.re"
+#line 234 "scanner.re"
}
line_source(o, a->d.rule->d.RuleOp.code->line);
SubStr_out(&a->d.rule->d.RuleOp.code->text, o);
fprintf(o, "\n"); oline++;
- fprintf(o, "#line %u \"%s\"\n", ++oline, outputFileName);
+ if (!iFlag)
+ fprintf(o, "#line %u \"%s\"\n", oline++, outputFileName);
break;
}
}
if(g->span[i].to != def)
*(t++) = &g->span[i];
+ if (dFlag)
+ fputs("\tYYDEBUG(-1, yych);\n", o);
+
#if 0
if (*readCh) {
fputs("\tswitch((yych = *YYCURSOR)) {\n", o);
void State_emit(State *s, FILE *o, int *readCh){
if (vUsedLabels[s->label])
fprintf(o, "yy%u:", s->label);
+ if (dFlag)
+ fprintf(o, "\n\tYYDEBUG(%u, *YYCURSOR);\n", s->label);
Action_emit(s->action, o, readCh);
}
int maxFillIndexes, orgVFillIndexes;
unsigned int start_label;
+ hasFillLabels = (0<=vFillIndexes);
+ if (hasFillLabels && label!=0) {
+ fputs("re2c : error : multiple /*!re2c blocks aren't supported when -f is specified\n", stderr);
+ exit(1);
+ }
+
DFA_findSCCs(d);
d->head->link = d->head;
vFillIndexes = orgVFillIndexes;
oline = nOrgOline;
- hasFillLabels = (0<=vFillIndexes);
-
+ fputs("\n", o);
oline++;
- fprintf(o, "\n#line %u \"%s\"\n", ++oline, outputFileName);
+ if (!iFlag)
+ fprintf(o, "#line %u \"%s\"\n", oline++, outputFileName);
if (!hasFillLabels) {
fputs("{\n\tYYCTYPE yych;\n", o);
#include "tools/re2c/basics.h"
extern const char *fileName;
-extern const char *outputFileName;
+extern char *outputFileName;
extern int sFlag;
extern int bFlag;
+extern int dFlag;
+extern int iFlag;
extern int bUsedYYAccept;
extern unsigned int oline;
extern unsigned int maxFill;
extern unsigned char *xlat, *talx;
+char *mystrdup(const char *str);
+
#endif
#include "mbo_getopt.h"
const char *fileName = 0;
-const char *outputFileName = 0;
+char *outputFileName = 0;
int sFlag = 0;
int bFlag = 0;
+int dFlag = 0;
+int iFlag = 0;
int bUsedYYAccept = 0;
unsigned int oline = 1;
unsigned int maxFill = 1;
static const mbo_opt_struct OPTIONS[] = {
{'?', 0, "help"},
{'b', 0, "bit-vectors"},
+ {'d', 0, "debug-output"},
{'e', 0, "ecb"},
- {'h', 0, "help"},
- {'s', 0, "nested-ifs"},
{'f', 0, "storable-state"},
+ {'h', 0, "help"},
+ {'i', 0, "no-debug-info"},
{'o', 1, "output"},
+ {'s', 0, "nested-ifs"},
{'v', 0, "version"},
{'-', 0, NULL} /* end of args */
};
static void usage()
{
fprintf(stderr,
- "usage: re2c [-esbvh] file\n"
+ "usage: re2c [-esbvhd] file\n"
"\n"
"-? -h --help Display this info.\n"
"\n"
"\n"
"-o --output=output Specify the output file instead of stdout\n"
"\n"
+ "-d --debug-output Creates a parser that dumps information during\n"
+ " about the current position and in which state the\n"
+ " parser is.\n"
+ "\n"
+ "-i --no-debug-info Do not generate '#line' info (usefull for versioning).\n"
+ "\n"
"-v --version Show version information.\n"
"-V --vernum Show version as one number.\n");
}
+char *
+mystrdup(const char *str)
+{
+ size_t len;
+ char *copy;
+
+ len = strlen(str) + 1;
+ copy = malloc(len);
+ memcpy(copy, str, len);
+ return (copy);
+}
+
int main(int argc, char *argv[])
{
int c;
case 's':
sFlag = 1;
break;
+ case 'd':
+ dFlag = 1;
+ break;
case 'f':
vFillIndexes = 0;
break;
+ case 'i':
+ iFlag = 1;
+ break;
case 'o':
outputFileName = opt_arg;
break;
// set up the output stream
if (outputFileName == 0 || (fileName[0] == '-' && fileName[1] == '\0')) {
- outputFileName = "<stdout>";
+ outputFileName = mystrdup("<stdout>");
output = stdout;
} else {
+ int len;
+ char *src, *dst, *tmp;
+
output = fopen(outputFileName, "wt");
if (!output) {
fprintf(stderr, "can't open %s\n", outputFileName);
return 1;
}
+
+ len = strlen(outputFileName);
+ tmp = (char*)malloc((len+1)*2);
+
+ for (src = outputFileName, dst = tmp; *src; ++src)
+ {
+ if (*src == '\\')
+ *dst++ = *src;
+ *dst++ = *src;
+ }
+ *dst = '\0';
+
+ outputFileName = tmp;
}
parse(f, output);
+ free(outputFileName);
return 0;
}
extern void genCode(FILE *, RegExp*);
extern RegExp *mkDiff(RegExp*, RegExp*);
+extern RegExp *mkDot(void);
extern RegExp *strToRE(SubStr);
extern RegExp *strToCaseInsensitiveRE(SubStr);
extern RegExp *ranToRE(SubStr);
+extern RegExp *invToRE(SubStr);
extern RegExp *mkAlt(RegExp*, RegExp*);
int yylex(void);
void yyerror(const char*);
-static char *mystrdup(const char *str);
-
static unsigned int accept;
static RegExp *spec;
static Scanner *in;
return Scanner_scan(in);
}
-static char *
-mystrdup(const char *str)
-{
- size_t len;
- char *copy;
-
- len = strlen(str) + 1;
- copy = malloc(len);
- memcpy(copy, str, len);
- return (copy);
-}
-
void line_source(FILE *o, unsigned int line)
{
char * fnamebuf;
char * token;
+ if (iFlag)
+ return;
fprintf(o, "#line %u \"", line);
if( fileName != NULL ) {
fnamebuf = mystrdup( fileName );
-/* Generated by re2c 0.9.1-C on Sun Oct 9 01:08:48 2005
+/* Generated by re2c 0.9.1-C on Sun Oct 9 15:00:35 2005
*/
#line 1 "scanner.re"
#include <stdlib.h>
return cursor;
}
-#line 79 "scanner.re"
+#line 80 "scanner.re"
int
s->tok = cursor;
echo:
-#line 89 "scanner.c"
+#line 88 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
if(yych == '*') goto yy12;
goto yy3;
yy3:
-#line 117 "scanner.re"
+#line 118 "scanner.re"
{ goto echo; }
-#line 114 "scanner.c"
+#line 113 "scanner.c"
yy4: yych = *++YYCURSOR;
if(yych == '/') goto yy10;
goto yy3;
yy5: yych = *++YYCURSOR;
goto yy6;
yy6:
-#line 112 "scanner.re"
+#line 113 "scanner.re"
{ fwrite(s->tok, 1, cursor - s->tok, out);
s->tok = s->pos = cursor; s->cline++; oline++;
goto echo; }
-#line 125 "scanner.c"
+#line 124 "scanner.c"
yy7: yych = *++YYCURSOR;
goto yy8;
yy8:
-#line 115 "scanner.re"
+#line 116 "scanner.re"
{ fwrite(s->tok, 1, cursor - s->tok - 1, out); /* -1 so we don't write out the \0 */
if(cursor == s->eof) { RETURN(0); } }
-#line 132 "scanner.c"
+#line 131 "scanner.c"
yy9: yych = *++YYCURSOR;
goto yy3;
yy10: yych = *++YYCURSOR;
goto yy11;
yy11:
-#line 103 "scanner.re"
+#line 104 "scanner.re"
{
if (ignore_eoc) {
ignore_eoc = 0;
s->tok = s->pos = cursor;
goto echo;
}
-#line 148 "scanner.c"
+#line 147 "scanner.c"
yy12: yych = *++YYCURSOR;
if(yych == '!') goto yy14;
goto yy13;
yy19: yych = *++YYCURSOR;
goto yy20;
yy20:
-#line 94 "scanner.re"
+#line 95 "scanner.re"
{ fwrite(s->tok, 1, &cursor[-7] - s->tok, out);
s->tok = cursor;
RETURN(1); }
-#line 179 "scanner.c"
+#line 178 "scanner.c"
yy21: yych = *++YYCURSOR;
if(yych != 'x') goto yy13;
goto yy22;
yy27: yych = *++YYCURSOR;
goto yy28;
yy28:
-#line 97 "scanner.re"
+#line 98 "scanner.re"
{
fprintf(out, "#define YYMAXFILL %u\n", maxFill);
s->tok = s->pos = cursor;
ignore_eoc = 1;
goto echo;
}
-#line 208 "scanner.c"
+#line 207 "scanner.c"
}
-#line 118 "scanner.re"
+#line 119 "scanner.re"
}
s->tline = s->cline;
s->tok = cursor;
-#line 226 "scanner.c"
+#line 225 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
if(yych <= '/'){
if(yych <= '"'){
if(yych <= '\n'){
- if(yych <= '\b') goto yy51;
+ if(yych <= '\b') goto yy53;
if(yych <= '\t') goto yy47;
goto yy49;
} else {
if(yych == ' ') goto yy47;
- if(yych <= '!') goto yy51;
+ if(yych <= '!') goto yy53;
goto yy37;
}
} else {
- if(yych <= ')'){
- if(yych <= '&') goto yy51;
+ if(yych <= '*'){
+ if(yych <= '&') goto yy53;
if(yych <= '\'') goto yy39;
- goto yy43;
+ if(yych <= ')') goto yy43;
+ goto yy35;
} else {
- if(yych <= '*') goto yy35;
if(yych <= '+') goto yy44;
+ if(yych <= '-') goto yy53;
if(yych <= '.') goto yy51;
goto yy33;
}
if(yych <= '@'){
if(yych <= '<'){
if(yych == ';') goto yy43;
- goto yy51;
+ goto yy53;
} else {
if(yych <= '=') goto yy43;
if(yych == '?') goto yy44;
- goto yy51;
+ goto yy53;
}
} else {
if(yych <= '`'){
if(yych <= 'Z') goto yy45;
if(yych <= '[') goto yy41;
if(yych <= '\\') goto yy43;
- goto yy51;
+ goto yy53;
} else {
if(yych <= 'z') goto yy45;
if(yych <= '{') goto yy31;
if(yych <= '|') goto yy43;
- goto yy51;
+ goto yy53;
}
}
}
yy31: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yych <= '/') goto yy32;
- if(yych <= '9') goto yy77;
+ if(yych <= '9') goto yy84;
goto yy32;
yy32:
-#line 133 "scanner.re"
+#line 134 "scanner.re"
{ depth = 1;
goto code;
}
#line 292 "scanner.c"
yy33: yych = *++YYCURSOR;
- if(yych == '*') goto yy75;
+ if(yych == '*') goto yy82;
goto yy34;
yy34:
-#line 159 "scanner.re"
+#line 164 "scanner.re"
{ RETURN(*s->tok); }
#line 299 "scanner.c"
yy35: yych = *++YYCURSOR;
- if(yych == '/') goto yy73;
+ if(yych == '/') goto yy80;
goto yy36;
yy36:
-#line 161 "scanner.re"
+#line 166 "scanner.re"
{ yylval.op = *s->tok;
RETURN(CLOSE); }
#line 307 "scanner.c"
yy37: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych != '\n') goto yy69;
+ if(yych != '\n') goto yy76;
goto yy38;
yy38:
-#line 150 "scanner.re"
+#line 151 "scanner.re"
{ Scanner_fatal(s, "unterminated string constant (missing \")"); }
#line 315 "scanner.c"
yy39: yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych != '\n') goto yy64;
+ if(yych != '\n') goto yy71;
goto yy40;
yy40:
-#line 151 "scanner.re"
+#line 152 "scanner.re"
{ Scanner_fatal(s, "unterminated string constant (missing ')"); }
#line 323 "scanner.c"
yy41: yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych != '\n') goto yy58;
- goto yy42;
+ if(yych == '\n') goto yy42;
+ if(yych == '^') goto yy62;
+ goto yy60;
yy42:
-#line 157 "scanner.re"
+#line 162 "scanner.re"
{ Scanner_fatal(s, "unterminated range (missing ])"); }
-#line 331 "scanner.c"
+#line 332 "scanner.c"
yy43: yych = *++YYCURSOR;
goto yy34;
yy44: yych = *++YYCURSOR;
goto yy36;
yy45: yych = *++YYCURSOR;
- goto yy56;
+ goto yy58;
yy46:
-#line 176 "scanner.re"
+#line 181 "scanner.re"
{ SubStr substr;
s->cur = cursor;
substr = Scanner_token(s);
yylval.symbol = Symbol_find(&substr);
return ID; }
-#line 345 "scanner.c"
+#line 346 "scanner.c"
yy47: yych = *++YYCURSOR;
- goto yy54;
+ goto yy56;
yy48:
-#line 182 "scanner.re"
+#line 187 "scanner.re"
{ goto scan; }
-#line 351 "scanner.c"
+#line 352 "scanner.c"
yy49: yych = *++YYCURSOR;
goto yy50;
yy50:
-#line 184 "scanner.re"
+#line 189 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
s->pos = cursor; s->cline++;
goto scan;
}
-#line 360 "scanner.c"
+#line 361 "scanner.c"
yy51: yych = *++YYCURSOR;
goto yy52;
yy52:
-#line 189 "scanner.re"
+#line 194 "scanner.re"
+{ s->cur = cursor;
+ yylval.regexp = mkDot();
+ return RANGE;
+ }
+#line 370 "scanner.c"
+yy53: yych = *++YYCURSOR;
+ goto yy54;
+yy54:
+#line 199 "scanner.re"
{ fprintf(stderr, "unexpected character: '%c'\n", *s->tok);
goto scan;
}
-#line 368 "scanner.c"
-yy53: ++YYCURSOR;
+#line 378 "scanner.c"
+yy55: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy54;
-yy54: if(yych == '\t') goto yy53;
- if(yych == ' ') goto yy53;
+ goto yy56;
+yy56: if(yych == '\t') goto yy55;
+ if(yych == ' ') goto yy55;
goto yy48;
-yy55: ++YYCURSOR;
+yy57: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy56;
-yy56: if(yych <= '@'){
+ goto yy58;
+yy58: if(yych <= '@'){
if(yych <= '/') goto yy46;
- if(yych <= '9') goto yy55;
+ if(yych <= '9') goto yy57;
goto yy46;
} else {
- if(yych <= 'Z') goto yy55;
+ if(yych <= 'Z') goto yy57;
if(yych <= '`') goto yy46;
- if(yych <= 'z') goto yy55;
+ if(yych <= 'z') goto yy57;
goto yy46;
}
-yy57: ++YYCURSOR;
+yy59: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy58;
-yy58: if(yych <= '['){
- if(yych != '\n') goto yy57;
- goto yy59;
+ goto yy60;
+yy60: if(yych <= '['){
+ if(yych != '\n') goto yy59;
+ goto yy61;
} else {
- if(yych <= '\\') goto yy60;
- if(yych <= ']') goto yy61;
- goto yy57;
+ if(yych <= '\\') goto yy64;
+ if(yych <= ']') goto yy65;
+ goto yy59;
}
-yy59: YYCURSOR = YYMARKER;
+yy61: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy32;
case 1: goto yy38;
case 2: goto yy40;
case 3: goto yy42;
}
-yy60: ++YYCURSOR;
+yy62: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy59;
- goto yy57;
-yy61: yych = *++YYCURSOR;
- goto yy62;
-yy62:
-#line 153 "scanner.re"
+ goto yy63;
+yy63: if(yych <= '['){
+ if(yych == '\n') goto yy61;
+ goto yy62;
+ } else {
+ if(yych <= '\\') goto yy67;
+ if(yych <= ']') goto yy68;
+ goto yy62;
+ }
+yy64: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if(yych == '\n') goto yy61;
+ goto yy59;
+yy65: yych = *++YYCURSOR;
+ goto yy66;
+yy66:
+#line 158 "scanner.re"
{ s->cur = cursor;
yylval.regexp = ranToRE(Scanner_token(s));
return RANGE; }
-#line 421 "scanner.c"
-yy63: ++YYCURSOR;
+#line 443 "scanner.c"
+yy67: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy64;
-yy64: if(yych <= '&'){
- if(yych == '\n') goto yy59;
- goto yy63;
+ if(yych == '\n') goto yy61;
+ goto yy62;
+yy68: yych = *++YYCURSOR;
+ goto yy69;
+yy69:
+#line 154 "scanner.re"
+{ s->cur = cursor;
+ yylval.regexp = invToRE(Scanner_token(s));
+ return RANGE; }
+#line 456 "scanner.c"
+yy70: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy71;
+yy71: if(yych <= '&'){
+ if(yych == '\n') goto yy61;
+ goto yy70;
} else {
- if(yych <= '\'') goto yy66;
- if(yych != '\\') goto yy63;
- goto yy65;
+ if(yych <= '\'') goto yy73;
+ if(yych != '\\') goto yy70;
+ goto yy72;
}
-yy65: ++YYCURSOR;
+yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy59;
- goto yy63;
-yy66: yych = *++YYCURSOR;
- goto yy67;
-yy67:
-#line 146 "scanner.re"
+ if(yych == '\n') goto yy61;
+ goto yy70;
+yy73: yych = *++YYCURSOR;
+ goto yy74;
+yy74:
+#line 147 "scanner.re"
{ s->cur = cursor;
yylval.regexp = strToCaseInsensitiveRE(Scanner_token(s));
return STRING; }
-#line 446 "scanner.c"
-yy68: ++YYCURSOR;
+#line 481 "scanner.c"
+yy75: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy69;
-yy69: if(yych <= '!'){
- if(yych == '\n') goto yy59;
- goto yy68;
+ goto yy76;
+yy76: if(yych <= '!'){
+ if(yych == '\n') goto yy61;
+ goto yy75;
} else {
- if(yych <= '"') goto yy71;
- if(yych != '\\') goto yy68;
- goto yy70;
+ if(yych <= '"') goto yy78;
+ if(yych != '\\') goto yy75;
+ goto yy77;
}
-yy70: ++YYCURSOR;
+yy77: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy59;
- goto yy68;
-yy71: yych = *++YYCURSOR;
- goto yy72;
-yy72:
-#line 142 "scanner.re"
+ if(yych == '\n') goto yy61;
+ goto yy75;
+yy78: yych = *++YYCURSOR;
+ goto yy79;
+yy79:
+#line 143 "scanner.re"
{ s->cur = cursor;
yylval.regexp = strToRE(Scanner_token(s));
return STRING; }
-#line 471 "scanner.c"
-yy73: yych = *++YYCURSOR;
- goto yy74;
-yy74:
-#line 139 "scanner.re"
+#line 506 "scanner.c"
+yy80: yych = *++YYCURSOR;
+ goto yy81;
+yy81:
+#line 140 "scanner.re"
{ s->tok = cursor;
RETURN(0); }
-#line 478 "scanner.c"
-yy75: yych = *++YYCURSOR;
- goto yy76;
-yy76:
-#line 136 "scanner.re"
+#line 513 "scanner.c"
+yy82: yych = *++YYCURSOR;
+ goto yy83;
+yy83:
+#line 137 "scanner.re"
{ depth = 1;
goto comment; }
-#line 485 "scanner.c"
-yy77: ++YYCURSOR;
+#line 520 "scanner.c"
+yy84: ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- goto yy78;
-yy78: if(yych <= '/'){
- if(yych == ',') goto yy81;
- goto yy59;
+ goto yy85;
+yy85: if(yych <= '/'){
+ if(yych == ',') goto yy88;
+ goto yy61;
} else {
- if(yych <= '9') goto yy77;
- if(yych != '}') goto yy59;
- goto yy79;
+ if(yych <= '9') goto yy84;
+ if(yych != '}') goto yy61;
+ goto yy86;
}
-yy79: yych = *++YYCURSOR;
- goto yy80;
-yy80:
-#line 164 "scanner.re"
+yy86: yych = *++YYCURSOR;
+ goto yy87;
+yy87:
+#line 169 "scanner.re"
{ yylval.extop.minsize = atoi((char *)s->tok+1);
yylval.extop.maxsize = atoi((char *)s->tok+1);
RETURN(CLOSESIZE); }
-#line 505 "scanner.c"
-yy81: yych = *++YYCURSOR;
- if(yych != '}') goto yy85;
- goto yy82;
-yy82: yych = *++YYCURSOR;
- goto yy83;
-yy83:
-#line 172 "scanner.re"
+#line 540 "scanner.c"
+yy88: yych = *++YYCURSOR;
+ if(yych != '}') goto yy92;
+ goto yy89;
+yy89: yych = *++YYCURSOR;
+ goto yy90;
+yy90:
+#line 177 "scanner.re"
{ yylval.extop.minsize = atoi((char *)s->tok+1);
yylval.extop.maxsize = -1;
RETURN(CLOSESIZE); }
-#line 516 "scanner.c"
-yy84: ++YYCURSOR;
+#line 551 "scanner.c"
+yy91: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy85;
-yy85: if(yych <= '/') goto yy59;
- if(yych <= '9') goto yy84;
- if(yych != '}') goto yy59;
- goto yy86;
-yy86: yych = *++YYCURSOR;
- goto yy87;
-yy87:
-#line 168 "scanner.re"
+ goto yy92;
+yy92: if(yych <= '/') goto yy61;
+ if(yych <= '9') goto yy91;
+ if(yych != '}') goto yy61;
+ goto yy93;
+yy93: yych = *++YYCURSOR;
+ goto yy94;
+yy94:
+#line 173 "scanner.re"
{ yylval.extop.minsize = atoi((char *)s->tok+1);
yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)s->tok, ',')+1));
RETURN(CLOSESIZE); }
-#line 532 "scanner.c"
+#line 567 "scanner.c"
}
-#line 192 "scanner.re"
+#line 202 "scanner.re"
code:
-#line 539 "scanner.c"
+#line 574 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy88;
+ goto yy95;
++YYCURSOR;
-yy88:
+yy95:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= '&'){
if(yych <= '\n'){
- if(yych <= '\t') goto yy96;
- goto yy94;
+ if(yych <= '\t') goto yy103;
+ goto yy101;
} else {
- if(yych == '"') goto yy98;
- goto yy96;
+ if(yych == '"') goto yy105;
+ goto yy103;
}
} else {
if(yych <= '{'){
- if(yych <= '\'') goto yy99;
- if(yych <= 'z') goto yy96;
- goto yy92;
+ if(yych <= '\'') goto yy106;
+ if(yych <= 'z') goto yy103;
+ goto yy99;
} else {
- if(yych != '}') goto yy96;
- goto yy90;
+ if(yych != '}') goto yy103;
+ goto yy97;
}
}
-yy90: yych = *++YYCURSOR;
- goto yy91;
-yy91:
-#line 196 "scanner.re"
+yy97: yych = *++YYCURSOR;
+ goto yy98;
+yy98:
+#line 206 "scanner.re"
{ if(--depth == 0){
s->cur = cursor;
yylval.token = Token_new(Scanner_token(s), s->tline);
return CODE;
}
goto code; }
-#line 576 "scanner.c"
-yy92: yych = *++YYCURSOR;
- goto yy93;
-yy93:
-#line 202 "scanner.re"
+#line 611 "scanner.c"
+yy99: yych = *++YYCURSOR;
+ goto yy100;
+yy100:
+#line 212 "scanner.re"
{ ++depth;
goto code; }
-#line 583 "scanner.c"
-yy94: yych = *++YYCURSOR;
- goto yy95;
-yy95:
-#line 204 "scanner.re"
+#line 618 "scanner.c"
+yy101: yych = *++YYCURSOR;
+ goto yy102;
+yy102:
+#line 214 "scanner.re"
{ if(cursor == s->eof) Scanner_fatal(s, "missing '}'");
s->pos = cursor; s->cline++;
goto code;
}
-#line 592 "scanner.c"
-yy96: yych = *++YYCURSOR;
- goto yy97;
-yy97:
-#line 208 "scanner.re"
+#line 627 "scanner.c"
+yy103: yych = *++YYCURSOR;
+ goto yy104;
+yy104:
+#line 218 "scanner.re"
{ goto code; }
-#line 598 "scanner.c"
-yy98: yyaccept = 0;
+#line 633 "scanner.c"
+yy105: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == '\n') goto yy97;
- goto yy105;
-yy99: yyaccept = 0;
+ if(yych == '\n') goto yy104;
+ goto yy112;
+yy106: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == '\n') goto yy97;
- goto yy101;
-yy100: ++YYCURSOR;
+ if(yych == '\n') goto yy104;
+ goto yy108;
+yy107: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy101;
-yy101: if(yych <= '&'){
- if(yych != '\n') goto yy100;
- goto yy102;
+ goto yy108;
+yy108: if(yych <= '&'){
+ if(yych != '\n') goto yy107;
+ goto yy109;
} else {
- if(yych <= '\'') goto yy96;
- if(yych == '\\') goto yy103;
- goto yy100;
+ if(yych <= '\'') goto yy103;
+ if(yych == '\\') goto yy110;
+ goto yy107;
}
-yy102: YYCURSOR = YYMARKER;
+yy109: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy97;
+ case 0: goto yy104;
}
-yy103: ++YYCURSOR;
+yy110: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy102;
- goto yy100;
-yy104: ++YYCURSOR;
+ if(yych == '\n') goto yy109;
+ goto yy107;
+yy111: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy105;
-yy105: if(yych <= '!'){
- if(yych == '\n') goto yy102;
- goto yy104;
+ goto yy112;
+yy112: if(yych <= '!'){
+ if(yych == '\n') goto yy109;
+ goto yy111;
} else {
- if(yych <= '"') goto yy96;
- if(yych != '\\') goto yy104;
- goto yy106;
+ if(yych <= '"') goto yy103;
+ if(yych != '\\') goto yy111;
+ goto yy113;
}
-yy106: ++YYCURSOR;
+yy113: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yych == '\n') goto yy102;
- goto yy104;
+ if(yych == '\n') goto yy109;
+ goto yy111;
}
-#line 209 "scanner.re"
+#line 219 "scanner.re"
comment:
-#line 651 "scanner.c"
+#line 686 "scanner.c"
{
YYCTYPE yych;
- goto yy107;
+ goto yy114;
++YYCURSOR;
-yy107:
+yy114:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= ')'){
- if(yych == '\n') goto yy112;
- goto yy114;
+ if(yych == '\n') goto yy119;
+ goto yy121;
} else {
- if(yych <= '*') goto yy109;
- if(yych == '/') goto yy111;
- goto yy114;
+ if(yych <= '*') goto yy116;
+ if(yych == '/') goto yy118;
+ goto yy121;
}
-yy109: yych = *++YYCURSOR;
- if(yych == '/') goto yy117;
- goto yy110;
-yy110:
-#line 223 "scanner.re"
+yy116: yych = *++YYCURSOR;
+ if(yych == '/') goto yy124;
+ goto yy117;
+yy117:
+#line 233 "scanner.re"
{ goto comment; }
-#line 673 "scanner.c"
-yy111: yych = *++YYCURSOR;
- if(yych == '*') goto yy115;
- goto yy110;
-yy112: yych = *++YYCURSOR;
- goto yy113;
-yy113:
-#line 219 "scanner.re"
+#line 708 "scanner.c"
+yy118: yych = *++YYCURSOR;
+ if(yych == '*') goto yy122;
+ goto yy117;
+yy119: yych = *++YYCURSOR;
+ goto yy120;
+yy120:
+#line 229 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
s->tok = s->pos = cursor; s->cline++;
goto comment;
}
-#line 685 "scanner.c"
-yy114: yych = *++YYCURSOR;
- goto yy110;
-yy115: yych = *++YYCURSOR;
- goto yy116;
-yy116:
-#line 217 "scanner.re"
+#line 720 "scanner.c"
+yy121: yych = *++YYCURSOR;
+ goto yy117;
+yy122: yych = *++YYCURSOR;
+ goto yy123;
+yy123:
+#line 227 "scanner.re"
{ ++depth;
goto comment; }
-#line 694 "scanner.c"
-yy117: yych = *++YYCURSOR;
- goto yy118;
-yy118:
-#line 213 "scanner.re"
+#line 729 "scanner.c"
+yy124: yych = *++YYCURSOR;
+ goto yy125;
+yy125:
+#line 223 "scanner.re"
{ if(--depth == 0)
goto scan;
else
goto comment; }
-#line 703 "scanner.c"
+#line 738 "scanner.c"
}
-#line 224 "scanner.re"
+#line 234 "scanner.re"
}
any = [\000-\377];
dot = any \ [\n];
esc = dot \ [\\];
+istring = "[" "^" ((esc \ [\]]) | "\\" dot)* "]" ;
cstring = "[" ((esc \ [\]]) | "\\" dot)* "]" ;
dstring = "\"" ((esc \ ["] ) | "\\" dot)* "\"";
sstring = "'" ((esc \ ['] ) | "\\" dot)* "'" ;
"\"" { Scanner_fatal(s, "unterminated string constant (missing \")"); }
"'" { Scanner_fatal(s, "unterminated string constant (missing ')"); }
+ istring { s->cur = cursor;
+ yylval.regexp = invToRE(Scanner_token(s));
+ return RANGE; }
+
cstring { s->cur = cursor;
yylval.regexp = ranToRE(Scanner_token(s));
return RANGE; }
goto scan;
}
+ "." { s->cur = cursor;
+ yylval.regexp = mkDot();
+ return RANGE;
+ }
+
any { fprintf(stderr, "unexpected character: '%c'\n", *s->tok);
goto scan;
}