]> granicus.if.org Git - re2c/commitdiff
- Start new developement version 0.13.*
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 16 Apr 2007 21:21:11 +0000 (21:21 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 16 Apr 2007 21:21:11 +0000 (21:21 +0000)
- Add conditions: <cond, cond, ...> rule CODE
# This is the first step of many, probably the biggest one

28 files changed:
re2c/CHANGELOG
re2c/bootstrap/parser.cc
re2c/bootstrap/scanner.cc
re2c/bootstrap/y.tab.h
re2c/config_w32.h
re2c/configure.in
re2c/globals.h
re2c/main.cc
re2c/parser.h
re2c/parser.y
re2c/scanner.re
re2c/test/cond_error_00.c [new file with mode: 0755]
re2c/test/cond_error_00.re [new file with mode: 0755]
re2c/test/cond_error_01.c.c [new file with mode: 0755]
re2c/test/cond_error_01.c.re [new file with mode: 0755]
re2c/test/cond_error_02.c.c [new file with mode: 0755]
re2c/test/cond_error_02.c.re [new file with mode: 0755]
re2c/test/cond_error_03.c.c [new file with mode: 0755]
re2c/test/cond_error_03.c.re [new file with mode: 0755]
re2c/test/cond_error_04.c.c [new file with mode: 0755]
re2c/test/cond_error_04.c.re [new file with mode: 0755]
re2c/test/cond_error_05.c.c [new file with mode: 0755]
re2c/test/cond_error_05.c.re [new file with mode: 0755]
re2c/test/cond_error_06.c.c [new file with mode: 0755]
re2c/test/cond_error_06.c.re [new file with mode: 0755]
re2c/test/cond_error_07.c.c [new file with mode: 0755]
re2c/test/cond_error_07.c.re [new file with mode: 0755]
re2c/token.h

index bd2060cbc92143cf738db7b6cd2e58ef78db3265..6bc8d7c8fb10ff4d605bdc08f3c53d6b864deb10 100644 (file)
@@ -1,4 +1,7 @@
-Version 0.11.4 (2007-??-??)
+Version 0.13.0 (2007-??-??)
+---------------------------
+
+Version 0.12.0 (2007-??-??)
 ---------------------------
 
 Version 0.11.3 (2007-04-01)
index fbf03cbee144c465b7cdda48ebfddd20e78d170f..9baa0ff10c60c09961343047d90993179c15ce43 100644 (file)
    enum yytokentype {
      CLOSESIZE = 258,
      CLOSE = 259,
-     ID = 260,
-     CODE = 261,
-     RANGE = 262,
-     STRING = 263,
-     CONFIG = 264,
-     VALUE = 265,
-     NUMBER = 266
+     STAR = 260,
+     ID = 261,
+     CODE = 262,
+     RANGE = 263,
+     STRING = 264,
+     CONFIG = 265,
+     VALUE = 266,
+     NUMBER = 267
    };
 #endif
 /* Tokens.  */
 #define CLOSESIZE 258
 #define CLOSE 259
-#define ID 260
-#define CODE 261
-#define RANGE 262
-#define STRING 263
-#define CONFIG 264
-#define VALUE 265
-#define NUMBER 266
+#define STAR 260
+#define ID 261
+#define CODE 262
+#define RANGE 263
+#define STRING 264
+#define CONFIG 265
+#define VALUE 266
+#define NUMBER 267
 
 
 
@@ -111,9 +113,10 @@ int yylex();
 void yyerror(const char*);
 }
 
-static re2c::uint accept;
-static RegExp *spec;
-static Scanner *in = NULL;
+static re2c::uint       accept;
+static re2c::RegExpMap  specmap;
+static RegExp           *spec;
+static Scanner          *in = NULL;
 
 /* Bison version 1.875 emits a definition that is not working
  * with several g++ version. Hence we disable it here.
@@ -129,8 +132,11 @@ static Scanner *in = NULL;
 static char* strdup(const char* s)
 {
        char* rv = (char*)malloc(strlen(s) + 1);
+
        if (rv == NULL)
+       {
                return NULL;
+       }
        strcpy(rv, s);
        return rv;
 }
@@ -157,18 +163,19 @@ static char* strdup(const char* s)
 #endif
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 58 "parser.y"
+#line 62 "parser.y"
 typedef union YYSTYPE {
-    re2c::Symbol       *symbol;
-    re2c::RegExp       *regexp;
-    re2c::Token        *token;
-    char               op;
-    int                number;
-    re2c::ExtOp        extop;
-    re2c::Str          *str;
+       re2c::Symbol    *symbol;
+       re2c::RegExp    *regexp;
+       re2c::Token     *token;
+       char            op;
+       int             number;
+       re2c::ExtOp     extop;
+       re2c::Str       *str;
+       re2c::CondList  *clist;
 } YYSTYPE;
 /* Line 196 of yacc.c.  */
-#line 172 "parser.cc"
+#line 179 "parser.cc"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
@@ -180,7 +187,7 @@ typedef union YYSTYPE {
 
 
 /* Line 219 of yacc.c.  */
-#line 184 "parser.cc"
+#line 191 "parser.cc"
 
 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 # define YYSIZE_T __SIZE_TYPE__
@@ -331,20 +338,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state. */
 #define YYFINAL  2
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   37
+#define YYLAST   56
 
 /* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS  19
+#define YYNTOKENS  23
 /* YYNNTS -- Number of nonterminals. */
-#define YYNNTS  11
+#define YYNNTS  13
 /* YYNRULES -- Number of rules. */
-#define YYNRULES  26
+#define YYNRULES  35
 /* YYNRULES -- Number of states. */
-#define YYNSTATES  40
+#define YYNSTATES  55
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   266
+#define YYMAXUTOK   267
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -356,15 +363,15 @@ static const unsigned char yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-      17,    18,     2,     2,     2,     2,     2,    14,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,    13,
-       2,    12,     2,     2,     2,     2,     2,     2,     2,     2,
+      21,    22,     2,     2,    18,     2,     2,    15,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    14,
+      16,    13,    17,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,    16,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,    20,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,    15,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,    19,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -378,7 +385,7 @@ static const unsigned char yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11
+       5,     6,     7,     8,     9,    10,    11,    12
 };
 
 #if YYDEBUG
@@ -387,29 +394,34 @@ static const unsigned char yytranslate[] =
 static const unsigned char yyprhs[] =
 {
        0,     0,     3,     4,     7,    10,    15,    20,    25,    30,
-      34,    35,    38,    40,    44,    46,    50,    52,    55,    57,
-      60,    63,    65,    68,    70,    72,    74
+      34,    41,    47,    48,    50,    52,    54,    58,    59,    62,
+      64,    68,    70,    74,    76,    79,    81,    84,    87,    89,
+      91,    94,    97,    99,   101,   103
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
 static const yysigned_char yyrhs[] =
 {
-      20,     0,    -1,    -1,    20,    22,    -1,    20,    21,    -1,
-       5,    12,    24,    13,    -1,     9,    12,    10,    13,    -1,
-       9,    12,    11,    13,    -1,     5,    12,    24,    14,    -1,
-      24,    23,     6,    -1,    -1,    14,    24,    -1,    25,    -1,
-      24,    15,    25,    -1,    26,    -1,    25,    16,    26,    -1,
-      27,    -1,    26,    27,    -1,    29,    -1,    29,    28,    -1,
-      29,     3,    -1,     4,    -1,    28,     4,    -1,     5,    -1,
-       7,    -1,     8,    -1,    17,    24,    18,    -1
+      24,     0,    -1,    -1,    24,    26,    -1,    24,    25,    -1,
+       6,    13,    30,    14,    -1,     6,    13,    30,    15,    -1,
+      10,    13,    11,    14,    -1,    10,    13,    12,    14,    -1,
+      30,    29,     7,    -1,    16,    27,    17,    30,    29,     7,
+      -1,    16,    27,    17,    29,     7,    -1,    -1,     5,    -1,
+      28,    -1,     6,    -1,    28,    18,     6,    -1,    -1,    15,
+      30,    -1,    31,    -1,    30,    19,    31,    -1,    32,    -1,
+      31,    20,    32,    -1,    33,    -1,    32,    33,    -1,    35,
+      -1,    35,    34,    -1,    35,     3,    -1,     4,    -1,     5,
+      -1,    34,     4,    -1,    34,     5,    -1,     6,    -1,     8,
+      -1,     9,    -1,    21,    30,    22,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
-static const unsigned char yyrline[] =
+static const unsigned short int yyrline[] =
 {
-       0,    84,    84,    86,    88,    91,    95,    97,   101,   105,
-     110,   111,   115,   117,   121,   123,   130,   132,   136,   138,
-     152,   158,   160,   164,   168,   170,   172
+       0,    91,    91,    95,    96,   100,   108,   112,   118,   126,
+     135,   158,   171,   174,   179,   186,   191,   200,   203,   210,
+     214,   221,   225,   236,   240,   247,   251,   266,   273,   277,
+     281,   285,   292,   300,   304,   308
 };
 #endif
 
@@ -418,10 +430,11 @@ static const unsigned char yyrline[] =
    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 static const char *const yytname[] =
 {
-  "$end", "error", "$undefined", "CLOSESIZE", "CLOSE", "ID", "CODE",
-  "RANGE", "STRING", "CONFIG", "VALUE", "NUMBER", "'='", "';'", "'/'",
-  "'|'", "'\\\\'", "'('", "')'", "$accept", "spec", "decl", "rule", "look",
-  "expr", "diff", "term", "factor", "close", "primary", 0
+  "$end", "error", "$undefined", "CLOSESIZE", "CLOSE", "STAR", "ID",
+  "CODE", "RANGE", "STRING", "CONFIG", "VALUE", "NUMBER", "'='", "';'",
+  "'/'", "'<'", "'>'", "','", "'|'", "'\\\\'", "'('", "')'", "$accept",
+  "spec", "decl", "rule", "cond", "clist", "look", "expr", "diff", "term",
+  "factor", "close", "primary", 0
 };
 #endif
 
@@ -431,24 +444,27 @@ static const char *const yytname[] =
 static const unsigned short int yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,    61,    59,    47,   124,    92,    40,    41
+     265,   266,   267,    61,    59,    47,    60,    62,    44,   124,
+      92,    40,    41
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const unsigned char yyr1[] =
 {
-       0,    19,    20,    20,    20,    21,    21,    21,    21,    22,
-      23,    23,    24,    24,    25,    25,    26,    26,    27,    27,
-      27,    28,    28,    29,    29,    29,    29
+       0,    23,    24,    24,    24,    25,    25,    25,    25,    26,
+      26,    26,    27,    27,    27,    28,    28,    29,    29,    30,
+      30,    31,    31,    32,    32,    33,    33,    33,    34,    34,
+      34,    34,    35,    35,    35,    35
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const unsigned char yyr2[] =
 {
        0,     2,     0,     2,     2,     4,     4,     4,     4,     3,
-       0,     2,     1,     3,     1,     3,     1,     2,     1,     2,
-       2,     1,     2,     1,     1,     1,     3
+       6,     5,     0,     1,     1,     1,     3,     0,     2,     1,
+       3,     1,     3,     1,     2,     1,     2,     2,     1,     1,
+       2,     2,     1,     1,     1,     3
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -456,35 +472,39 @@ static const unsigned char yyr2[] =
    means the default is an error.  */
 static const unsigned char yydefact[] =
 {
-       2,     0,     1,    23,    24,    25,     0,     0,     4,     3,
-      10,    12,    14,    16,    18,     0,     0,    23,     0,     0,
-       0,     0,     0,    17,    20,    21,    19,     0,     0,     0,
-      26,    11,    13,     9,    15,    22,     5,     8,     6,     7
+       2,     0,     1,    32,    33,    34,     0,    12,     0,     4,
+       3,    17,    19,    21,    23,    25,     0,     0,    13,    15,
+       0,    14,    32,     0,     0,     0,     0,     0,    24,    27,
+      28,    29,    26,     0,     0,     0,    17,     0,    35,    18,
+      20,     9,    22,    30,    31,     5,     6,     7,     8,     0,
+      17,    16,    11,     0,    10
 };
 
 /* YYDEFGOTO[NTERM-NUM]. */
 static const yysigned_char yydefgoto[] =
 {
-      -1,     1,     8,     9,    21,    10,    11,    12,    13,    26,
-      14
+      -1,     1,     9,    10,    20,    21,    26,    11,    12,    13,
+      14,    32,    15
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -13
+#define YYPACT_NINF -36
 static const yysigned_char yypact[] =
 {
-     -13,     1,   -13,    -5,   -13,   -13,     0,    -3,   -13,   -13,
-       9,    13,    -3,   -13,    22,    -3,    17,   -13,    -2,    -3,
-      -3,    11,    -3,   -13,   -13,   -13,    26,     6,    18,    19,
-     -13,    20,    13,   -13,    -3,   -13,   -13,   -13,   -13,   -13
+     -36,     3,   -36,    -9,   -36,   -36,    -7,    28,    17,   -36,
+     -36,    12,     8,    17,   -36,    36,    17,    25,   -36,   -36,
+       5,    26,   -36,    13,    17,    17,    39,    17,   -36,   -36,
+     -36,   -36,    38,     2,    31,    33,    -1,    42,   -36,    30,
+       8,   -36,    17,   -36,   -36,   -36,   -36,   -36,   -36,    43,
+      12,   -36,   -36,    44,   -36
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yysigned_char yypgoto[] =
 {
-     -13,   -13,   -13,   -13,   -13,    -4,    14,    15,   -12,   -13,
-     -13
+     -36,   -36,   -36,   -36,   -36,   -36,   -35,    -6,    27,    29,
+     -13,   -36,   -36
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -494,28 +514,34 @@ static const yysigned_char yypgoto[] =
 #define YYTABLE_NINF -1
 static const unsigned char yytable[] =
 {
-      23,     2,    17,    18,     4,     5,     3,    15,     4,     5,
-       6,    27,    16,    20,     7,    31,    30,    33,     7,    36,
-      37,    20,    23,    19,    20,    24,    25,    28,    29,    22,
-      35,    38,    39,     0,    32,    20,     0,    34
+      28,    49,    23,     2,    16,    22,    17,     4,     5,     3,
+      33,     4,     5,     6,    24,    53,    45,    46,    39,     7,
+       8,    25,    36,    22,     8,     4,     5,    24,    27,    28,
+      50,    25,    25,    18,    19,    38,    34,    35,     8,    29,
+      30,    31,    43,    44,    37,    47,    41,    48,    51,    25,
+      52,    54,    40,     0,     0,     0,    42
 };
 
 static const yysigned_char yycheck[] =
 {
-      12,     0,     5,     7,     7,     8,     5,    12,     7,     8,
-       9,    15,    12,    15,    17,    19,    18,     6,    17,    13,
-      14,    15,    34,    14,    15,     3,     4,    10,    11,    16,
-       4,    13,    13,    -1,    20,    15,    -1,    22
+      13,    36,     8,     0,    13,     6,    13,     8,     9,     6,
+      16,     8,     9,    10,    15,    50,    14,    15,    24,    16,
+      21,    19,    17,     6,    21,     8,     9,    15,    20,    42,
+      36,    19,    19,     5,     6,    22,    11,    12,    21,     3,
+       4,     5,     4,     5,    18,    14,     7,    14,     6,    19,
+       7,     7,    25,    -1,    -1,    -1,    27
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const unsigned char yystos[] =
 {
-       0,    20,     0,     5,     7,     8,     9,    17,    21,    22,
-      24,    25,    26,    27,    29,    12,    12,     5,    24,    14,
-      15,    23,    16,    27,     3,     4,    28,    24,    10,    11,
-      18,    24,    25,     6,    26,     4,    13,    14,    13,    13
+       0,    24,     0,     6,     8,     9,    10,    16,    21,    25,
+      26,    30,    31,    32,    33,    35,    13,    13,     5,     6,
+      27,    28,     6,    30,    15,    19,    29,    20,    33,     3,
+       4,     5,    34,    30,    11,    12,    17,    18,    22,    30,
+      31,     7,    32,     4,     5,    14,    15,    14,    14,    29,
+      30,     6,     7,    29,     7
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -1185,145 +1211,286 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 84 "parser.y"
-    { accept = 0;
-                 spec = NULL; }
-    break;
-
-  case 3:
-#line 87 "parser.y"
-    { spec = spec? mkAlt(spec, (yyvsp[0].regexp)) : (yyvsp[0].regexp); }
+#line 91 "parser.y"
+    {
+                       accept = 0;
+                       spec = NULL;
+               }
     break;
 
   case 5:
-#line 92 "parser.y"
-    { if((yyvsp[-3].symbol)->re)
-                     in->fatal("sym already defined");
-                 (yyvsp[-3].symbol)->re = (yyvsp[-1].regexp); }
+#line 101 "parser.y"
+    {
+                       if((yyvsp[-3].symbol)->re)
+                       {
+                               in->fatal("sym already defined");
+                       }
+                       (yyvsp[-3].symbol)->re = (yyvsp[-1].regexp);
+               }
     break;
 
   case 6:
-#line 96 "parser.y"
-    { in->config(*(yyvsp[-3].str), *(yyvsp[-1].str)); delete (yyvsp[-3].str); delete (yyvsp[-1].str); }
+#line 109 "parser.y"
+    {
+                       in->fatal("trailing contexts are not allowed in named definitions");
+               }
     break;
 
   case 7:
-#line 98 "parser.y"
-    { in->config(*(yyvsp[-3].str), (yyvsp[-1].number)); delete (yyvsp[-3].str); }
+#line 113 "parser.y"
+    {
+                       in->config(*(yyvsp[-3].str), *(yyvsp[-1].str));
+                       delete (yyvsp[-3].str);
+                       delete (yyvsp[-1].str);
+               }
     break;
 
   case 8:
-#line 102 "parser.y"
-    { in->fatal("trailing contexts are not allowed in named definitions"); }
+#line 119 "parser.y"
+    {
+                       in->config(*(yyvsp[-3].str), (yyvsp[-1].number));
+                       delete (yyvsp[-3].str);
+               }
     break;
 
   case 9:
-#line 106 "parser.y"
-    { (yyval.regexp) = new RuleOp((yyvsp[-2].regexp), (yyvsp[-1].regexp), (yyvsp[0].token), accept++); }
+#line 127 "parser.y"
+    {
+                       if (cFlag)
+                       {
+                               in->fatal("condition or '<*>' required when using -c switch");
+                       }
+                       (yyval.regexp) = new RuleOp((yyvsp[-2].regexp), (yyvsp[-1].regexp), (yyvsp[0].token), accept++);
+                       spec = spec? mkAlt(spec, (yyval.regexp)) : (yyval.regexp);
+               }
     break;
 
   case 10:
-#line 110 "parser.y"
-    { (yyval.regexp) = new NullOp; }
+#line 136 "parser.y"
+    {
+                       if (!cFlag)
+                       {
+                               delete (yyvsp[-4].clist);
+                               in->fatal("conditions are only allowed when using -c switch");
+                       }
+                       for(CondList::const_iterator it = (yyvsp[-4].clist)->begin(); it != (yyvsp[-4].clist)->end(); ++it)
+                       {
+                               // Duplicating stuff, slow but safe
+                               (yyval.regexp) = new RuleOp((yyvsp[-2].regexp), (yyvsp[-1].regexp), new Token(*(yyvsp[0].token)), accept++);
+                               
+                               RegExpMap::iterator itRE = specmap.find(*it);
+                               
+                               if (itRE != specmap.end())
+                               {
+                                       (yyval.regexp) = mkAlt(itRE->second, (yyval.regexp));
+                               }
+                               specmap[*it] = (yyval.regexp);
+                       }
+                       delete (yyvsp[-4].clist);
+                       delete (yyvsp[0].token);
+               }
     break;
 
   case 11:
-#line 112 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 159 "parser.y"
+    {
+                       delete (yyvsp[-3].clist);
+                       if (!cFlag)
+                       {
+                               in->fatal("conditions are only allowed when using -c switch");
+                       }
+                       in->fatal("no expression specified");
+               }
     break;
 
   case 12:
-#line 116 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 171 "parser.y"
+    {
+                       in->fatal("unnamed condition not supported");
+               }
     break;
 
   case 13:
-#line 118 "parser.y"
-    { (yyval.regexp) =  mkAlt((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
+#line 175 "parser.y"
+    {
+                       (yyval.clist) = new CondList();
+                       (yyval.clist)->insert("*");
+               }
     break;
 
   case 14:
-#line 122 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 180 "parser.y"
+    {
+                       (yyval.clist) = (yyvsp[0].clist);
+               }
     break;
 
   case 15:
-#line 124 "parser.y"
-    { (yyval.regexp) =  mkDiff((yyvsp[-2].regexp), (yyvsp[0].regexp));
-                 if(!(yyval.regexp))
-                      in->fatal("can only difference char sets");
+#line 187 "parser.y"
+    {
+                       (yyval.clist) = new CondList();
+                       (yyval.clist)->insert((yyvsp[0].symbol)->GetName().to_string());
                }
     break;
 
   case 16:
-#line 131 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 192 "parser.y"
+    {
+                       (yyvsp[-2].clist)->insert((yyvsp[0].symbol)->GetName().to_string());
+                       (yyval.clist) = (yyvsp[-2].clist);
+               }
     break;
 
   case 17:
-#line 133 "parser.y"
-    { (yyval.regexp) = new CatOp((yyvsp[-1].regexp), (yyvsp[0].regexp)); }
+#line 200 "parser.y"
+    {
+                       (yyval.regexp) = new NullOp;
+               }
     break;
 
   case 18:
-#line 137 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 204 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[0].regexp);
+               }
     break;
 
   case 19:
-#line 139 "parser.y"
+#line 211 "parser.y"
     {
-                   switch((yyvsp[0].op)){
-                   case '*':
-                       (yyval.regexp) = mkAlt(new CloseOp((yyvsp[-1].regexp)), new NullOp());
-                       break;
-                   case '+':
-                       (yyval.regexp) = new CloseOp((yyvsp[-1].regexp));
-                       break;
-                   case '?':
-                       (yyval.regexp) = mkAlt((yyvsp[-1].regexp), new NullOp());
-                       break;
-                   }
+                       (yyval.regexp) = (yyvsp[0].regexp);
                }
     break;
 
   case 20:
-#line 153 "parser.y"
+#line 215 "parser.y"
     {
-                       (yyval.regexp) = new CloseVOp((yyvsp[-1].regexp), (yyvsp[0].extop).minsize, (yyvsp[0].extop).maxsize);
+                       (yyval.regexp) = mkAlt((yyvsp[-2].regexp), (yyvsp[0].regexp));
                }
     break;
 
   case 21:
-#line 159 "parser.y"
-    { (yyval.op) = (yyvsp[0].op); }
+#line 222 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[0].regexp);
+               }
     break;
 
   case 22:
-#line 161 "parser.y"
-    { (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*'; }
+#line 226 "parser.y"
+    {
+                       (yyval.regexp) = mkDiff((yyvsp[-2].regexp), (yyvsp[0].regexp));
+                       if(!(yyval.regexp))
+                       {
+                               in->fatal("can only difference char sets");
+                       }
+               }
     break;
 
   case 23:
-#line 165 "parser.y"
-    { if(!(yyvsp[0].symbol)->re)
-                     in->fatal("can't find symbol");
-                 (yyval.regexp) = (yyvsp[0].symbol)->re; }
+#line 237 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[0].regexp);
+               }
     break;
 
   case 24:
-#line 169 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 241 "parser.y"
+    {
+                       (yyval.regexp) = new CatOp((yyvsp[-1].regexp), (yyvsp[0].regexp));
+               }
     break;
 
   case 25:
-#line 171 "parser.y"
-    { (yyval.regexp) = (yyvsp[0].regexp); }
+#line 248 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[0].regexp);
+               }
     break;
 
   case 26:
-#line 173 "parser.y"
-    { (yyval.regexp) = (yyvsp[-1].regexp); }
+#line 252 "parser.y"
+    {
+                       switch((yyvsp[0].op))
+                       {
+                       case '*':
+                               (yyval.regexp) = mkAlt(new CloseOp((yyvsp[-1].regexp)), new NullOp());
+                               break;
+                       case '+':
+                               (yyval.regexp) = new CloseOp((yyvsp[-1].regexp));
+                               break;
+                       case '?':
+                               (yyval.regexp) = mkAlt((yyvsp[-1].regexp), new NullOp());
+                               break;
+                       }
+               }
+    break;
+
+  case 27:
+#line 267 "parser.y"
+    {
+                       (yyval.regexp) = new CloseVOp((yyvsp[-1].regexp), (yyvsp[0].extop).minsize, (yyvsp[0].extop).maxsize);
+               }
+    break;
+
+  case 28:
+#line 274 "parser.y"
+    {
+                       (yyval.op) = (yyvsp[0].op);
+               }
+    break;
+
+  case 29:
+#line 278 "parser.y"
+    {
+                       (yyval.op) = (yyvsp[0].op);
+               }
+    break;
+
+  case 30:
+#line 282 "parser.y"
+    {
+                       (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*';
+               }
+    break;
+
+  case 31:
+#line 286 "parser.y"
+    {
+                       (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*';
+               }
+    break;
+
+  case 32:
+#line 293 "parser.y"
+    {
+                       if(!(yyvsp[0].symbol)->re)
+                       {
+                               in->fatal("can't find symbol");
+                       }
+                       (yyval.regexp) = (yyvsp[0].symbol)->re;
+               }
+    break;
+
+  case 33:
+#line 301 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[0].regexp);
+               }
+    break;
+
+  case 34:
+#line 305 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[0].regexp);
+               }
+    break;
+
+  case 35:
+#line 309 "parser.y"
+    {
+                       (yyval.regexp) = (yyvsp[-1].regexp);
+               }
     break;
 
 
@@ -1331,7 +1498,7 @@ yyreduce:
     }
 
 /* Line 1126 of yacc.c.  */
-#line 1335 "parser.cc"
+#line 1502 "parser.cc"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -1599,17 +1766,17 @@ yyreturn:
 }
 
 
-#line 176 "parser.y"
+#line 314 "parser.y"
 
 
 extern "C" {
 void yyerror(const char* s)
 {
-    in->fatal(s);
+       in->fatal(s);
 }
 
 int yylex(){
-    return in ? in->scan() : 0;
+       return in ? in->scan() : 0;
 }
 } // end extern "C"
 
@@ -1633,7 +1800,19 @@ void parse(Scanner& i, std::ostream& o)
        while(i.echo())
        {
                yyparse();
-               if(spec)
+               if (cFlag)
+               {
+                       for(RegExpMap::const_iterator it = specmap.begin(); it != specmap.end(); ++it)
+                       {
+                               if (it->second)
+                               {
+                                       o << "yyc_" << it->first << ":\n";
+                                       spec = it->second;
+                                       genCode(o, topIndent, spec);
+                               }
+                       }
+               }
+               else if(spec)
                {
                        genCode(o, topIndent, spec);
                }
@@ -1643,6 +1822,7 @@ void parse(Scanner& i, std::ostream& o)
        RegExp::vFreeList.clear();
        Range::vFreeList.clear();
        Symbol::ClearTable();
+       specmap.clear();
        in = NULL;
 }
 
index 2d62616c98b91be87cc9d9579e079abfac699944..6581c43a8500cd397019de1efc0bd95ac7ba578a 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.11.4.dev on Sat Apr 14 08:51:37 2007 */
+/* Generated by re2c 0.11.4.dev on Mon Apr 16 14:36:05 2007 */
 #line 1 "scanner.re"
 /* $Id$ */
 #include <stdlib.h>
@@ -409,69 +409,61 @@ scan:
                unsigned int yyaccept = 0;
                if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
                yych = *YYCURSOR;
-               if(yych <= ':') {
-                       if(yych <= '"') {
+               if(yych <= '.') {
+                       if(yych <= '!') {
                                if(yych <= 0x0C) {
-                                       if(yych <= 0x08) goto yy85;
-                                       if(yych <= 0x09) goto yy79;
-                                       if(yych <= 0x0A) goto yy81;
-                                       goto yy85;
+                                       if(yych <= 0x08) goto yy86;
+                                       if(yych <= 0x09) goto yy80;
+                                       if(yych <= 0x0A) goto yy82;
+                                       goto yy86;
                                } else {
-                                       if(yych <= 0x1F) {
-                                               if(yych <= 0x0D) goto yy83;
-                                               goto yy85;
-                                       } else {
-                                               if(yych <= ' ') goto yy79;
-                                               if(yych <= '!') goto yy85;
-                                               goto yy66;
-                                       }
+                                       if(yych <= 0x0D) goto yy84;
+                                       if(yych == ' ') goto yy80;
+                                       goto yy86;
                                }
                        } else {
-                               if(yych <= '*') {
-                                       if(yych <= '&') goto yy85;
+                               if(yych <= ')') {
+                                       if(yych <= '"') goto yy66;
+                                       if(yych <= '&') goto yy86;
                                        if(yych <= '\'') goto yy68;
-                                       if(yych <= ')') goto yy72;
-                                       goto yy64;
+                                       goto yy72;
                                } else {
-                                       if(yych <= '-') {
-                                               if(yych <= '+') goto yy73;
-                                               goto yy85;
+                                       if(yych <= '+') {
+                                               if(yych <= '*') goto yy64;
+                                               goto yy73;
                                        } else {
-                                               if(yych <= '.') goto yy77;
-                                               if(yych <= '/') goto yy62;
-                                               goto yy85;
+                                               if(yych <= ',') goto yy72;
+                                               if(yych <= '-') goto yy86;
+                                               goto yy78;
                                        }
                                }
                        }
                } else {
                        if(yych <= '\\') {
-                               if(yych <= '>') {
-                                       if(yych == '<') goto yy85;
-                                       if(yych <= '=') goto yy72;
-                                       goto yy85;
+                               if(yych <= '?') {
+                                       if(yych <= '/') goto yy62;
+                                       if(yych <= ':') goto yy86;
+                                       if(yych <= '>') goto yy72;
+                                       goto yy73;
                                } else {
-                                       if(yych <= '@') {
-                                               if(yych <= '?') goto yy73;
-                                               goto yy85;
-                                       } else {
-                                               if(yych <= 'Z') goto yy76;
-                                               if(yych <= '[') goto yy70;
-                                               goto yy72;
-                                       }
+                                       if(yych <= '@') goto yy86;
+                                       if(yych <= 'Z') goto yy77;
+                                       if(yych <= '[') goto yy70;
+                                       goto yy72;
                                }
                        } else {
                                if(yych <= 'q') {
-                                       if(yych == '_') goto yy76;
-                                       if(yych <= '`') goto yy85;
-                                       goto yy76;
+                                       if(yych == '_') goto yy77;
+                                       if(yych <= '`') goto yy86;
+                                       goto yy77;
                                } else {
                                        if(yych <= 'z') {
-                                               if(yych <= 'r') goto yy74;
-                                               goto yy76;
+                                               if(yych <= 'r') goto yy75;
+                                               goto yy77;
                                        } else {
                                                if(yych <= '{') goto yy60;
                                                if(yych <= '|') goto yy72;
-                                               goto yy85;
+                                               goto yy86;
                                        }
                                }
                        }
@@ -480,10 +472,10 @@ yy60:
                yyaccept = 0;
                yych = *(YYMARKER = ++YYCURSOR);
                if(yych <= '/') {
-                       if(yych == ',') goto yy126;
+                       if(yych == ',') goto yy127;
                } else {
-                       if(yych <= '0') goto yy123;
-                       if(yych <= '9') goto yy124;
+                       if(yych <= '0') goto yy124;
+                       if(yych <= '9') goto yy125;
                }
 yy61:
 #line 227 "scanner.re"
@@ -491,114 +483,118 @@ yy61:
                                        depth = 1;
                                        goto code;
                                }
-#line 495 "scanner.cc"
+#line 487 "scanner.cc"
 yy62:
                ++YYCURSOR;
-               if((yych = *YYCURSOR) == '*') goto yy121;
+               if((yych = *YYCURSOR) == '*') goto yy122;
 yy63:
 #line 277 "scanner.re"
                {
                                        RETURN(*tok);
                                }
-#line 504 "scanner.cc"
+#line 496 "scanner.cc"
 yy64:
                ++YYCURSOR;
-               if((yych = *YYCURSOR) == '/') goto yy119;
-yy65:
+               if((yych = *YYCURSOR) == '/') goto yy120;
 #line 281 "scanner.re"
                {
                                        yylval.op = *tok;
-                                       RETURN(CLOSE);
+                                       RETURN(STAR);
                                }
-#line 514 "scanner.cc"
+#line 505 "scanner.cc"
 yy66:
                yyaccept = 1;
                yych = *(YYMARKER = ++YYCURSOR);
-               if(yych != 0x0A) goto yy115;
+               if(yych != 0x0A) goto yy116;
 yy67:
 #line 254 "scanner.re"
                {
                                        fatal("unterminated string constant (missing \")");
                                }
-#line 524 "scanner.cc"
+#line 515 "scanner.cc"
 yy68:
                yyaccept = 2;
                yych = *(YYMARKER = ++YYCURSOR);
-               if(yych != 0x0A) goto yy110;
+               if(yych != 0x0A) goto yy111;
 yy69:
 #line 257 "scanner.re"
                {
                                        fatal("unterminated string constant (missing ')");
                                }
-#line 534 "scanner.cc"
+#line 525 "scanner.cc"
 yy70:
                yyaccept = 3;
                yych = *(YYMARKER = ++YYCURSOR);
                if(yych == 0x0A) goto yy71;
-               if(yych == '^') goto yy101;
-               goto yy100;
+               if(yych == '^') goto yy102;
+               goto yy101;
 yy71:
 #line 273 "scanner.re"
                {
                                        fatal("unterminated range (missing ])");
                                }
-#line 546 "scanner.cc"
+#line 537 "scanner.cc"
 yy72:
                yych = *++YYCURSOR;
                goto yy63;
 yy73:
-               yych = *++YYCURSOR;
-               goto yy65;
-yy74:
                ++YYCURSOR;
-               if((yych = *YYCURSOR) == 'e') goto yy91;
-               goto yy90;
+#line 285 "scanner.re"
+               {
+                                       yylval.op = *tok;
+                                       RETURN(CLOSE);
+                               }
+#line 548 "scanner.cc"
 yy75:
-#line 321 "scanner.re"
+               ++YYCURSOR;
+               if((yych = *YYCURSOR) == 'e') goto yy92;
+               goto yy91;
+yy76:
+#line 325 "scanner.re"
                {
                                        cur = cursor;
                                        yylval.symbol = Symbol::find(token());
                                        return ID;
                                }
-#line 564 "scanner.cc"
-yy76:
-               yych = *++YYCURSOR;
-               goto yy90;
+#line 560 "scanner.cc"
 yy77:
+               yych = *++YYCURSOR;
+               goto yy91;
+yy78:
                ++YYCURSOR;
-#line 327 "scanner.re"
+#line 331 "scanner.re"
                {
                                        cur = cursor;
                                        yylval.regexp = mkDot();
                                        return RANGE;
                                }
-#line 576 "scanner.cc"
-yy79:
+#line 572 "scanner.cc"
+yy80:
                ++YYCURSOR;
                yych = *YYCURSOR;
-               goto yy88;
-yy80:
-#line 333 "scanner.re"
+               goto yy89;
+yy81:
+#line 337 "scanner.re"
                {
                                        goto scan;
                                }
-#line 586 "scanner.cc"
-yy81:
-               ++YYCURSOR;
+#line 582 "scanner.cc"
 yy82:
-#line 337 "scanner.re"
+               ++YYCURSOR;
+yy83:
+#line 341 "scanner.re"
                {
                                        if(cursor == eof) RETURN(0);
                                        pos = cursor;
                                        cline++;
                                        goto scan;
                                }
-#line 597 "scanner.cc"
-yy83:
-               ++YYCURSOR;
-               if((yych = *YYCURSOR) == 0x0A) goto yy86;
+#line 593 "scanner.cc"
 yy84:
-#line 344 "scanner.re"
+               ++YYCURSOR;
+               if((yych = *YYCURSOR) == 0x0A) goto yy87;
+yy85:
+#line 348 "scanner.re"
                {
                                        std::ostringstream msg;
                                        msg << "unexpected character: ";
@@ -606,51 +602,51 @@ yy84:
                                        fatal(msg.str().c_str());
                                        goto scan;
                                }
-#line 610 "scanner.cc"
-yy85:
-               yych = *++YYCURSOR;
-               goto yy84;
+#line 606 "scanner.cc"
 yy86:
                yych = *++YYCURSOR;
-               goto yy82;
+               goto yy85;
 yy87:
+               yych = *++YYCURSOR;
+               goto yy83;
+yy88:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy88:
+yy89:
                if(yybm[0+yych] & 4) {
-                       goto yy87;
+                       goto yy88;
                }
-               goto yy80;
-yy89:
+               goto yy81;
+yy90:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy90:
+yy91:
                if(yybm[0+yych] & 8) {
-                       goto yy89;
+                       goto yy90;
                }
-               goto yy75;
-yy91:
+               goto yy76;
+yy92:
                yych = *++YYCURSOR;
-               if(yych != '2') goto yy90;
+               if(yych != '2') goto yy91;
                yych = *++YYCURSOR;
-               if(yych != 'c') goto yy90;
+               if(yych != 'c') goto yy91;
                yyaccept = 4;
                yych = *(YYMARKER = ++YYCURSOR);
-               if(yych != ':') goto yy90;
-yy94:
+               if(yych != ':') goto yy91;
+yy95:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yych <= '^') {
-                       if(yych <= '@') goto yy95;
-                       if(yych <= 'Z') goto yy96;
+                       if(yych <= '@') goto yy96;
+                       if(yych <= 'Z') goto yy97;
                } else {
-                       if(yych == '`') goto yy95;
-                       if(yych <= 'z') goto yy96;
+                       if(yych == '`') goto yy96;
+                       if(yych <= 'z') goto yy97;
                }
-yy95:
+yy96:
                YYCURSOR = YYMARKER;
                if(yyaccept <= 3) {
                        if(yyaccept <= 1) {
@@ -669,36 +665,36 @@ yy95:
                } else {
                        if(yyaccept <= 5) {
                                if(yyaccept <= 4) {
-                                       goto yy75;
+                                       goto yy76;
                                } else {
-                                       goto yy98;
+                                       goto yy99;
                                }
                        } else {
-                               goto yy127;
+                               goto yy128;
                        }
                }
-yy96:
+yy97:
                yyaccept = 5;
                YYMARKER = ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yych <= 'Z') {
                        if(yych <= '9') {
-                               if(yych >= '0') goto yy96;
+                               if(yych >= '0') goto yy97;
                        } else {
-                               if(yych <= ':') goto yy94;
-                               if(yych >= 'A') goto yy96;
+                               if(yych <= ':') goto yy95;
+                               if(yych >= 'A') goto yy97;
                        }
                } else {
                        if(yych <= '_') {
-                               if(yych >= '_') goto yy96;
+                               if(yych >= '_') goto yy97;
                        } else {
-                               if(yych <= '`') goto yy98;
-                               if(yych <= 'z') goto yy96;
+                               if(yych <= '`') goto yy99;
+                               if(yych <= 'z') goto yy97;
                        }
                }
-yy98:
-#line 313 "scanner.re"
+yy99:
+#line 317 "scanner.re"
                {
                                        cur = cursor;
                                        tok+= 5; /* skip "re2c:" */
@@ -706,37 +702,37 @@ yy98:
                                        yylval.str = new Str(token());
                                        return CONFIG;
                                }
-#line 710 "scanner.cc"
-yy99:
+#line 706 "scanner.cc"
+yy100:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy100:
+yy101:
                if(yybm[0+yych] & 16) {
-                       goto yy99;
+                       goto yy100;
                }
-               if(yych <= '[') goto yy95;
-               if(yych <= '\\') goto yy103;
-               goto yy104;
-yy101:
+               if(yych <= '[') goto yy96;
+               if(yych <= '\\') goto yy104;
+               goto yy105;
+yy102:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yych <= '[') {
-                       if(yych == 0x0A) goto yy95;
-                       goto yy101;
+                       if(yych == 0x0A) goto yy96;
+                       goto yy102;
                } else {
-                       if(yych <= '\\') goto yy106;
-                       if(yych <= ']') goto yy107;
-                       goto yy101;
+                       if(yych <= '\\') goto yy107;
+                       if(yych <= ']') goto yy108;
+                       goto yy102;
                }
-yy103:
+yy104:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy95;
-               goto yy99;
-yy104:
+               if(yych == 0x0A) goto yy96;
+               goto yy100;
+yy105:
                ++YYCURSOR;
 #line 267 "scanner.re"
                {
@@ -744,14 +740,14 @@ yy104:
                                        yylval.regexp = ranToRE(token());
                                        return RANGE;
                                }
-#line 748 "scanner.cc"
-yy106:
+#line 744 "scanner.cc"
+yy107:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy95;
-               goto yy101;
-yy107:
+               if(yych == 0x0A) goto yy96;
+               goto yy102;
+yy108:
                ++YYCURSOR;
 #line 261 "scanner.re"
                {
@@ -759,23 +755,23 @@ yy107:
                                        yylval.regexp = invToRE(token());
                                        return RANGE;
                                }
-#line 763 "scanner.cc"
-yy109:
+#line 759 "scanner.cc"
+yy110:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy110:
+yy111:
                if(yybm[0+yych] & 32) {
-                       goto yy109;
+                       goto yy110;
                }
-               if(yych <= '&') goto yy95;
-               if(yych <= '\'') goto yy112;
+               if(yych <= '&') goto yy96;
+               if(yych <= '\'') goto yy113;
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy95;
-               goto yy109;
-yy112:
+               if(yych == 0x0A) goto yy96;
+               goto yy110;
+yy113:
                ++YYCURSOR;
 #line 248 "scanner.re"
                {
@@ -783,23 +779,23 @@ yy112:
                                        yylval.regexp = strToCaseInsensitiveRE(token());
                                        return STRING;
                                }
-#line 787 "scanner.cc"
-yy114:
+#line 783 "scanner.cc"
+yy115:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy115:
+yy116:
                if(yybm[0+yych] & 64) {
-                       goto yy114;
+                       goto yy115;
                }
-               if(yych <= '!') goto yy95;
-               if(yych <= '"') goto yy117;
+               if(yych <= '!') goto yy96;
+               if(yych <= '"') goto yy118;
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy95;
-               goto yy114;
-yy117:
+               if(yych == 0x0A) goto yy96;
+               goto yy115;
+yy118:
                ++YYCURSOR;
 #line 242 "scanner.re"
                {
@@ -807,100 +803,100 @@ yy117:
                                        yylval.regexp = strToRE(token());
                                        return STRING;
                                }
-#line 811 "scanner.cc"
-yy119:
+#line 807 "scanner.cc"
+yy120:
                ++YYCURSOR;
 #line 237 "scanner.re"
                {
                                        tok = cursor;
                                        RETURN(0);
                                }
-#line 819 "scanner.cc"
-yy121:
+#line 815 "scanner.cc"
+yy122:
                ++YYCURSOR;
 #line 232 "scanner.re"
                {
                                        depth = 1;
                                        goto comment;
                                }
-#line 827 "scanner.cc"
-yy123:
-               yych = *++YYCURSOR;
-               if(yych == ',') goto yy137;
-               goto yy125;
+#line 823 "scanner.cc"
 yy124:
+               yych = *++YYCURSOR;
+               if(yych == ',') goto yy138;
+               goto yy126;
+yy125:
                ++YYCURSOR;
                if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
                yych = *YYCURSOR;
-yy125:
+yy126:
                if(yybm[0+yych] & 128) {
-                       goto yy124;
+                       goto yy125;
                }
-               if(yych == ',') goto yy130;
-               if(yych == '}') goto yy128;
-               goto yy95;
-yy126:
-               ++YYCURSOR;
+               if(yych == ',') goto yy131;
+               if(yych == '}') goto yy129;
+               goto yy96;
 yy127:
-#line 309 "scanner.re"
+               ++YYCURSOR;
+yy128:
+#line 313 "scanner.re"
                {
                                        fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers");
                                }
-#line 850 "scanner.cc"
-yy128:
+#line 846 "scanner.cc"
+yy129:
                ++YYCURSOR;
-#line 291 "scanner.re"
+#line 295 "scanner.re"
                {
                                        yylval.extop.minsize = atoi((char *)tok+1);
                                        yylval.extop.maxsize = atoi((char *)tok+1);
                                        RETURN(CLOSESIZE);
                                }
-#line 859 "scanner.cc"
-yy130:
+#line 855 "scanner.cc"
+yy131:
                yyaccept = 6;
                yych = *(YYMARKER = ++YYCURSOR);
-               if(yych <= '/') goto yy127;
-               if(yych <= '9') goto yy133;
-               if(yych != '}') goto yy127;
+               if(yych <= '/') goto yy128;
+               if(yych <= '9') goto yy134;
+               if(yych != '}') goto yy128;
                ++YYCURSOR;
-#line 303 "scanner.re"
+#line 307 "scanner.re"
                {
                                        yylval.extop.minsize = atoi((char *)tok+1);
                                        yylval.extop.maxsize = -1;
                                        RETURN(CLOSESIZE);
                                }
-#line 873 "scanner.cc"
-yy133:
+#line 869 "scanner.cc"
+yy134:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych <= '/') goto yy95;
-               if(yych <= '9') goto yy133;
-               if(yych != '}') goto yy95;
+               if(yych <= '/') goto yy96;
+               if(yych <= '9') goto yy134;
+               if(yych != '}') goto yy96;
                ++YYCURSOR;
-#line 297 "scanner.re"
+#line 301 "scanner.re"
                {
                                        yylval.extop.minsize = atoi((char *)tok+1);
                                        yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
                                        RETURN(CLOSESIZE);
                                }
-#line 888 "scanner.cc"
-yy137:
+#line 884 "scanner.cc"
+yy138:
                yyaccept = 6;
                yych = *(YYMARKER = ++YYCURSOR);
-               if(yych <= '/') goto yy127;
-               if(yych <= '9') goto yy133;
-               if(yych != '}') goto yy127;
+               if(yych <= '/') goto yy128;
+               if(yych <= '9') goto yy134;
+               if(yych != '}') goto yy128;
                ++YYCURSOR;
-#line 286 "scanner.re"
+#line 290 "scanner.re"
                {
                                        yylval.op = '*';
                                        RETURN(CLOSE);
                                }
-#line 901 "scanner.cc"
+#line 897 "scanner.cc"
        }
 }
-#line 351 "scanner.re"
+#line 355 "scanner.re"
 
 
 code:
@@ -940,31 +936,31 @@ code:
                192, 192, 192, 192, 192, 192, 192, 192, 
        };
 
-#line 944 "scanner.cc"
+#line 940 "scanner.cc"
        {
                YYCTYPE yych;
                if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
                yych = *YYCURSOR;
                if(yych <= '&') {
                        if(yych <= 0x0A) {
-                               if(yych <= 0x00) goto yy148;
-                               if(yych <= 0x09) goto yy150;
-                               goto yy146;
+                               if(yych <= 0x00) goto yy149;
+                               if(yych <= 0x09) goto yy151;
+                               goto yy147;
                        } else {
-                               if(yych == '"') goto yy152;
-                               goto yy150;
+                               if(yych == '"') goto yy153;
+                               goto yy151;
                        }
                } else {
                        if(yych <= '{') {
-                               if(yych <= '\'') goto yy153;
-                               if(yych <= 'z') goto yy150;
-                               goto yy144;
+                               if(yych <= '\'') goto yy154;
+                               if(yych <= 'z') goto yy151;
+                               goto yy145;
                        } else {
-                               if(yych != '}') goto yy150;
+                               if(yych != '}') goto yy151;
                        }
                }
                ++YYCURSOR;
-#line 355 "scanner.re"
+#line 359 "scanner.re"
                {
                                        if(--depth == 0)
                                        {
@@ -974,18 +970,18 @@ code:
                                        }
                                        goto code;
                                }
-#line 978 "scanner.cc"
-yy144:
+#line 974 "scanner.cc"
+yy145:
                ++YYCURSOR;
-#line 364 "scanner.re"
+#line 368 "scanner.re"
                {
                                        ++depth;
                                        goto code;
                                }
-#line 986 "scanner.cc"
-yy146:
+#line 982 "scanner.cc"
+yy147:
                ++YYCURSOR;
-#line 368 "scanner.re"
+#line 372 "scanner.re"
                {
                                        if(cursor == eof)
                                        {
@@ -995,10 +991,10 @@ yy146:
                                        cline++;
                                        goto code;
                                }
-#line 999 "scanner.cc"
-yy148:
+#line 995 "scanner.cc"
+yy149:
                ++YYCURSOR;
-#line 377 "scanner.re"
+#line 381 "scanner.re"
                {
                                        if(cursor == eof)
                                        {
@@ -1010,84 +1006,84 @@ yy148:
                                        }
                                        goto code;
                                }
-#line 1014 "scanner.cc"
-yy150:
-               ++YYCURSOR;
+#line 1010 "scanner.cc"
 yy151:
-#line 388 "scanner.re"
+               ++YYCURSOR;
+yy152:
+#line 392 "scanner.re"
                {
                                        goto code;
                                }
-#line 1022 "scanner.cc"
-yy152:
-               yych = *(YYMARKER = ++YYCURSOR);
-               if(yych == 0x0A) goto yy151;
-               goto yy159;
+#line 1018 "scanner.cc"
 yy153:
                yych = *(YYMARKER = ++YYCURSOR);
-               if(yych == 0x0A) goto yy151;
-               goto yy155;
+               if(yych == 0x0A) goto yy152;
+               goto yy160;
 yy154:
+               yych = *(YYMARKER = ++YYCURSOR);
+               if(yych == 0x0A) goto yy152;
+               goto yy156;
+yy155:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy155:
+yy156:
                if(yybm[0+yych] & 64) {
-                       goto yy154;
+                       goto yy155;
                }
-               if(yych <= '&') goto yy156;
-               if(yych <= '\'') goto yy150;
-               goto yy157;
-yy156:
-               YYCURSOR = YYMARKER;
-               goto yy151;
+               if(yych <= '&') goto yy157;
+               if(yych <= '\'') goto yy151;
+               goto yy158;
 yy157:
+               YYCURSOR = YYMARKER;
+               goto yy152;
+yy158:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy156;
-               goto yy154;
-yy158:
+               if(yych == 0x0A) goto yy157;
+               goto yy155;
+yy159:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy159:
+yy160:
                if(yybm[0+yych] & 128) {
-                       goto yy158;
+                       goto yy159;
                }
-               if(yych <= '!') goto yy156;
-               if(yych <= '"') goto yy150;
+               if(yych <= '!') goto yy157;
+               if(yych <= '"') goto yy151;
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy156;
-               goto yy158;
+               if(yych == 0x0A) goto yy157;
+               goto yy159;
        }
 }
-#line 391 "scanner.re"
+#line 395 "scanner.re"
 
 
 comment:
 {
 
-#line 1074 "scanner.cc"
+#line 1070 "scanner.cc"
        {
                YYCTYPE yych;
                if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
                yych = *YYCURSOR;
                if(yych <= ')') {
-                       if(yych == 0x0A) goto yy166;
-                       goto yy168;
+                       if(yych == 0x0A) goto yy167;
+                       goto yy169;
                } else {
-                       if(yych <= '*') goto yy163;
-                       if(yych == '/') goto yy165;
-                       goto yy168;
+                       if(yych <= '*') goto yy164;
+                       if(yych == '/') goto yy166;
+                       goto yy169;
                }
-yy163:
-               ++YYCURSOR;
-               if((yych = *YYCURSOR) == '/') goto yy171;
 yy164:
-#line 419 "scanner.re"
+               ++YYCURSOR;
+               if((yych = *YYCURSOR) == '/') goto yy172;
+yy165:
+#line 423 "scanner.re"
                {
                                        if(cursor == eof)
                                        {
@@ -1095,14 +1091,14 @@ yy164:
                                        }
                                        goto comment;
                                }
-#line 1099 "scanner.cc"
-yy165:
-               yych = *++YYCURSOR;
-               if(yych == '*') goto yy169;
-               goto yy164;
+#line 1095 "scanner.cc"
 yy166:
+               yych = *++YYCURSOR;
+               if(yych == '*') goto yy170;
+               goto yy165;
+yy167:
                ++YYCURSOR;
-#line 410 "scanner.re"
+#line 414 "scanner.re"
                {
                                        if(cursor == eof)
                                        {
@@ -1112,22 +1108,22 @@ yy166:
                                        cline++;
                                        goto comment;
                                }
-#line 1116 "scanner.cc"
-yy168:
-               yych = *++YYCURSOR;
-               goto yy164;
+#line 1112 "scanner.cc"
 yy169:
+               yych = *++YYCURSOR;
+               goto yy165;
+yy170:
                ++YYCURSOR;
-#line 405 "scanner.re"
+#line 409 "scanner.re"
                {
                                        ++depth;
                                        fatal("ambiguous /* found");
                                        goto comment;
                                }
-#line 1128 "scanner.cc"
-yy171:
+#line 1124 "scanner.cc"
+yy172:
                ++YYCURSOR;
-#line 395 "scanner.re"
+#line 399 "scanner.re"
                {
                                        if(--depth == 0)
                                        {
@@ -1138,10 +1134,10 @@ yy171:
                                                goto comment;
                                        }
                                }
-#line 1142 "scanner.cc"
+#line 1138 "scanner.cc"
        }
 }
-#line 426 "scanner.re"
+#line 430 "scanner.re"
 
 
 config:
@@ -1181,67 +1177,67 @@ config:
                  0,   0,   0,   0,   0,   0,   0,   0, 
        };
 
-#line 1185 "scanner.cc"
+#line 1181 "scanner.cc"
        {
                YYCTYPE yych;
                if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
                yych = *YYCURSOR;
                if(yych <= 0x1F) {
-                       if(yych != 0x09) goto yy179;
+                       if(yych != 0x09) goto yy180;
                } else {
-                       if(yych <= ' ') goto yy175;
-                       if(yych == '=') goto yy177;
-                       goto yy179;
+                       if(yych <= ' ') goto yy176;
+                       if(yych == '=') goto yy178;
+                       goto yy180;
                }
-yy175:
+yy176:
                ++YYCURSOR;
                yych = *YYCURSOR;
-               goto yy184;
-yy176:
-#line 430 "scanner.re"
+               goto yy185;
+yy177:
+#line 434 "scanner.re"
                {
                                        goto config;
                                }
-#line 1206 "scanner.cc"
-yy177:
+#line 1202 "scanner.cc"
+yy178:
                ++YYCURSOR;
                yych = *YYCURSOR;
-               goto yy182;
-yy178:
-#line 433 "scanner.re"
+               goto yy183;
+yy179:
+#line 437 "scanner.re"
                {
                                        iscfg = 2;
                                        cur = cursor;
                                        RETURN('=');
                                }
-#line 1218 "scanner.cc"
-yy179:
+#line 1214 "scanner.cc"
+yy180:
                ++YYCURSOR;
-#line 438 "scanner.re"
+#line 442 "scanner.re"
                {
                                        fatal("missing '='");
                                }
-#line 1225 "scanner.cc"
-yy181:
+#line 1221 "scanner.cc"
+yy182:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy182:
+yy183:
                if(yybm[0+yych] & 128) {
-                       goto yy181;
+                       goto yy182;
                }
-               goto yy178;
-yy183:
+               goto yy179;
+yy184:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy184:
-               if(yych == 0x09) goto yy183;
-               if(yych == ' ') goto yy183;
-               goto yy176;
+yy185:
+               if(yych == 0x09) goto yy184;
+               if(yych == ' ') goto yy184;
+               goto yy177;
        }
 }
-#line 441 "scanner.re"
+#line 445 "scanner.re"
 
 
 value:
@@ -1281,205 +1277,205 @@ value:
                248, 248, 248, 248, 248, 248, 248, 248, 
        };
 
-#line 1285 "scanner.cc"
+#line 1281 "scanner.cc"
        {
                YYCTYPE yych;
                if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
                yych = *YYCURSOR;
                if(yych <= '&') {
                        if(yych <= 0x0D) {
-                               if(yych <= 0x08) goto yy193;
-                               if(yych <= 0x0A) goto yy187;
-                               if(yych <= 0x0C) goto yy193;
+                               if(yych <= 0x08) goto yy194;
+                               if(yych <= 0x0A) goto yy188;
+                               if(yych <= 0x0C) goto yy194;
                        } else {
                                if(yych <= ' ') {
-                                       if(yych <= 0x1F) goto yy193;
+                                       if(yych <= 0x1F) goto yy194;
                                } else {
-                                       if(yych == '"') goto yy195;
-                                       goto yy193;
+                                       if(yych == '"') goto yy196;
+                                       goto yy194;
                                }
                        }
                } else {
                        if(yych <= '/') {
-                               if(yych <= '\'') goto yy197;
-                               if(yych == '-') goto yy190;
-                               goto yy193;
+                               if(yych <= '\'') goto yy198;
+                               if(yych == '-') goto yy191;
+                               goto yy194;
                        } else {
                                if(yych <= '9') {
-                                       if(yych <= '0') goto yy188;
-                                       goto yy191;
+                                       if(yych <= '0') goto yy189;
+                                       goto yy192;
                                } else {
-                                       if(yych != ';') goto yy193;
+                                       if(yych != ';') goto yy194;
                                }
                        }
                }
-yy187:
-#line 451 "scanner.re"
+yy188:
+#line 455 "scanner.re"
                {
                                        cur = cursor;
                                        yylval.str = new Str(token());
                                        iscfg = 0;
                                        return VALUE;
                                }
-#line 1325 "scanner.cc"
-yy188:
+#line 1321 "scanner.cc"
+yy189:
                ++YYCURSOR;
                if(yybm[0+(yych = *YYCURSOR)] & 8) {
-                       goto yy193;
+                       goto yy194;
                }
-yy189:
-#line 445 "scanner.re"
+yy190:
+#line 449 "scanner.re"
                {
                                        cur = cursor;
                                        yylval.number = atoi(token().to_string().c_str());
                                        iscfg = 0;
                                        return NUMBER;
                                }
-#line 1339 "scanner.cc"
-yy190:
-               yych = *++YYCURSOR;
-               if(yych <= '0') goto yy194;
-               if(yych >= ':') goto yy194;
+#line 1335 "scanner.cc"
 yy191:
+               yych = *++YYCURSOR;
+               if(yych <= '0') goto yy195;
+               if(yych >= ':') goto yy195;
+yy192:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yybm[0+yych] & 4) {
-                       goto yy191;
+                       goto yy192;
                }
                if(yych <= 0x0D) {
-                       if(yych <= 0x08) goto yy193;
-                       if(yych <= 0x0A) goto yy189;
-                       if(yych >= 0x0D) goto yy189;
+                       if(yych <= 0x08) goto yy194;
+                       if(yych <= 0x0A) goto yy190;
+                       if(yych >= 0x0D) goto yy190;
                } else {
                        if(yych <= ' ') {
-                               if(yych >= ' ') goto yy189;
+                               if(yych >= ' ') goto yy190;
                        } else {
-                               if(yych == ';') goto yy189;
+                               if(yych == ';') goto yy190;
                        }
                }
-yy193:
+yy194:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-yy194:
+yy195:
                if(yybm[0+yych] & 8) {
-                       goto yy193;
+                       goto yy194;
                }
-               goto yy187;
-yy195:
+               goto yy188;
+yy196:
                YYMARKER = ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yybm[0+yych] & 16) {
-                       goto yy195;
+                       goto yy196;
                }
                if(yych <= '!') {
-                       if(yych == 0x0A) goto yy187;
-                       goto yy205;
+                       if(yych == 0x0A) goto yy188;
+                       goto yy206;
                } else {
-                       if(yych <= '"') goto yy193;
-                       if(yych <= '[') goto yy205;
-                       goto yy207;
+                       if(yych <= '"') goto yy194;
+                       if(yych <= '[') goto yy206;
+                       goto yy208;
                }
-yy197:
+yy198:
                YYMARKER = ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yybm[0+yych] & 32) {
-                       goto yy197;
+                       goto yy198;
                }
                if(yych <= '&') {
-                       if(yych == 0x0A) goto yy187;
+                       if(yych == 0x0A) goto yy188;
                } else {
-                       if(yych <= '\'') goto yy193;
-                       if(yych >= '\\') goto yy202;
+                       if(yych <= '\'') goto yy194;
+                       if(yych >= '\\') goto yy203;
                }
-yy199:
+yy200:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yybm[0+yych] & 64) {
-                       goto yy199;
+                       goto yy200;
                }
-               if(yych <= '&') goto yy201;
-               if(yych <= '\'') goto yy203;
-               goto yy204;
-yy201:
-               YYCURSOR = YYMARKER;
-               goto yy187;
+               if(yych <= '&') goto yy202;
+               if(yych <= '\'') goto yy204;
+               goto yy205;
 yy202:
+               YYCURSOR = YYMARKER;
+               goto yy188;
+yy203:
                YYMARKER = ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yych <= 0x0D) {
                        if(yych <= 0x09) {
-                               if(yych <= 0x08) goto yy197;
-                               goto yy199;
+                               if(yych <= 0x08) goto yy198;
+                               goto yy200;
                        } else {
-                               if(yych <= 0x0A) goto yy187;
-                               if(yych <= 0x0C) goto yy197;
-                               goto yy199;
+                               if(yych <= 0x0A) goto yy188;
+                               if(yych <= 0x0C) goto yy198;
+                               goto yy200;
                        }
                } else {
                        if(yych <= ' ') {
-                               if(yych <= 0x1F) goto yy197;
-                               goto yy199;
+                               if(yych <= 0x1F) goto yy198;
+                               goto yy200;
                        } else {
-                               if(yych == ';') goto yy199;
-                               goto yy197;
+                               if(yych == ';') goto yy200;
+                               goto yy198;
                        }
                }
-yy203:
-               yych = *++YYCURSOR;
-               goto yy187;
 yy204:
+               yych = *++YYCURSOR;
+               goto yy188;
+yy205:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy201;
-               goto yy199;
-yy205:
+               if(yych == 0x0A) goto yy202;
+               goto yy200;
+yy206:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yybm[0+yych] & 128) {
-                       goto yy205;
+                       goto yy206;
                }
-               if(yych <= '!') goto yy201;
-               if(yych <= '"') goto yy203;
-               goto yy208;
-yy207:
+               if(yych <= '!') goto yy202;
+               if(yych <= '"') goto yy204;
+               goto yy209;
+yy208:
                YYMARKER = ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
                if(yych <= 0x0D) {
                        if(yych <= 0x09) {
-                               if(yych <= 0x08) goto yy195;
-                               goto yy205;
+                               if(yych <= 0x08) goto yy196;
+                               goto yy206;
                        } else {
-                               if(yych <= 0x0A) goto yy187;
-                               if(yych <= 0x0C) goto yy195;
-                               goto yy205;
+                               if(yych <= 0x0A) goto yy188;
+                               if(yych <= 0x0C) goto yy196;
+                               goto yy206;
                        }
                } else {
                        if(yych <= ' ') {
-                               if(yych <= 0x1F) goto yy195;
-                               goto yy205;
+                               if(yych <= 0x1F) goto yy196;
+                               goto yy206;
                        } else {
-                               if(yych == ';') goto yy205;
-                               goto yy195;
+                               if(yych == ';') goto yy206;
+                               goto yy196;
                        }
                }
-yy208:
+yy209:
                ++YYCURSOR;
                if(YYLIMIT == YYCURSOR) YYFILL(1);
                yych = *YYCURSOR;
-               if(yych == 0x0A) goto yy201;
-               goto yy205;
+               if(yych == 0x0A) goto yy202;
+               goto yy206;
        }
 }
-#line 457 "scanner.re"
+#line 461 "scanner.re"
 
 }
 
index 1c3e5849eac4419f47c6f8570cf5f26a39cfdc72..49e44d85c58ed7edcfd04dec13404c74c9c0bee6 100644 (file)
    enum yytokentype {
      CLOSESIZE = 258,
      CLOSE = 259,
-     ID = 260,
-     CODE = 261,
-     RANGE = 262,
-     STRING = 263,
-     CONFIG = 264,
-     VALUE = 265,
-     NUMBER = 266
+     STAR = 260,
+     ID = 261,
+     CODE = 262,
+     RANGE = 263,
+     STRING = 264,
+     CONFIG = 265,
+     VALUE = 266,
+     NUMBER = 267
    };
 #endif
 /* Tokens.  */
 #define CLOSESIZE 258
 #define CLOSE 259
-#define ID 260
-#define CODE 261
-#define RANGE 262
-#define STRING 263
-#define CONFIG 264
-#define VALUE 265
-#define NUMBER 266
+#define STAR 260
+#define ID 261
+#define CODE 262
+#define RANGE 263
+#define STRING 264
+#define CONFIG 265
+#define VALUE 266
+#define NUMBER 267
 
 
 
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 58 "parser.y"
+#line 62 "parser.y"
 typedef union YYSTYPE {
-    re2c::Symbol       *symbol;
-    re2c::RegExp       *regexp;
-    re2c::Token        *token;
-    char               op;
-    int                number;
-    re2c::ExtOp        extop;
-    re2c::Str          *str;
+       re2c::Symbol    *symbol;
+       re2c::RegExp    *regexp;
+       re2c::Token     *token;
+       char            op;
+       int             number;
+       re2c::ExtOp     extop;
+       re2c::Str       *str;
+       re2c::CondList  *clist;
 } YYSTYPE;
 /* Line 1447 of yacc.c.  */
-#line 70 "y.tab.h"
+#line 73 "y.tab.h"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
index f4e1958043cc1f224027875f73365d1ebd253207..bd6d0d011da8d5b83df43af16f74a9bd72664b5d 100644 (file)
 #define PACKAGE_NAME "re2c"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "re2c 0.11.4.dev"
+#define PACKAGE_STRING "re2c 0.13.0.dev"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "re2c"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.11.4.dev"
+#define PACKAGE_VERSION "0.13.0.dev"
 
 /* The size of a `char', as computed by sizeof. */
 #define SIZEOF_CHAR 1
@@ -87,7 +87,7 @@
 #define STDC_HEADERS 1
 
 /* Version number of package */
-#define VERSION "0.11.4.dev"
+#define VERSION "0.13.0.dev"
 
 /* Define to empty if `const' does not conform to ANSI C. */
 /* #undef const */
index 7876604db5653f72a4059e7368e6a8c165ca7873..9fe4f171bf2b39346cb25d6be266ff047ce15226 100644 (file)
@@ -1,5 +1,5 @@
 AC_PREREQ([2.57])
-AC_INIT(re2c, 0.11.4.dev, re2c-general@lists.sourceforge.net)
+AC_INIT(re2c, 0.13.0.dev, re2c-general@lists.sourceforge.net)
 AM_INIT_AUTOMAKE(re2c, $PACKAGE_VERSION)
 AC_CONFIG_SRCDIR(actions.cc)
 AM_CONFIG_HEADER(config.h)
index e1ca8021430c6579aeb6a1dfe89d2633e2e1ca05..12d7bc9fb4d9e9c04e5129755303b8f70faa32ca 100644 (file)
@@ -16,6 +16,7 @@ extern file_info sourceFileInfo;
 extern file_info outputFileInfo;
 
 extern bool bFlag;
+extern bool cFlag;
 extern bool dFlag;
 extern bool eFlag;
 extern bool fFlag;
index b8ac2fd33ade653138c44689a5b97f0d4ac4c63f..ec1bdb50d6f0eeba2f6bf45c0c6782fdcaae1387 100644 (file)
@@ -22,6 +22,7 @@ file_info sourceFileInfo;
 file_info outputFileInfo;
 
 bool bFlag = false;
+bool cFlag = false;
 bool dFlag = false;
 bool eFlag = false;
 bool fFlag = false;
@@ -78,6 +79,7 @@ static const mbo_opt_struct OPTIONS[] =
 {
        mbo_opt_struct('?', 0, "help"),
        mbo_opt_struct('b', 0, "bit-vectors"),
+       mbo_opt_struct('c', 0, "start-conditions"),
        mbo_opt_struct('d', 0, "debug-output"),
        mbo_opt_struct('e', 0, "ecb"),
        mbo_opt_struct('f', 0, "storable-state"),
@@ -106,6 +108,8 @@ static void usage()
        "                        specifications with more than a few keywords (e.g. for\n"
        "                        most programming languages).\n"
        "\n"
+       "-c     --conditions     Require start conditions.\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"
@@ -129,6 +133,7 @@ static void usage()
        "-u     --unicode        Implies -w but supports the full Unicode character set.\n"
        "\n"
        "-v     --version        Show version information.\n"
+       "\n"
        "-V     --vernum         Show version as one number.\n"
        "\n"
        "-w     --wide-chars     Create a parser that supports wide chars (UCS-2). This\n"
@@ -169,6 +174,10 @@ int main(int argc, char *argv[])
                        sFlag = true;
                        break;
 
+                       case 'c':
+                       cFlag = true;
+                       break;
+
                        case 'e':
                        xlat = asc2ebc;
                        talx = ebc2asc;
index df788eb6f5082f950b677241b493a8a611ccf1da..5f2b80f61615cfe02600220e33c2e8bbd6ccfbe7 100644 (file)
@@ -6,6 +6,7 @@
 #include "re.h"
 #include <iosfwd>
 #include <map>
+#include <set>
 
 namespace re2c
 {
@@ -20,6 +21,11 @@ public:
        static void ClearTable();
 
        typedef std::map<std::string, Symbol*> SymbolTable;
+       
+       const Str& GetName() const
+       {
+               return name;
+       }
 
 protected:
 
@@ -49,6 +55,9 @@ private:
 #endif
 };
 
+typedef std::set<std::string>           CondList;
+typedef std::map<std::string, RegExp*>  RegExpMap;
+
 void parse(Scanner&, std::ostream&);
 
 } // end namespace re2c
index 0e014db7c10e5b18fd14ab5f1f848066b75f4cf1..c3602809f0cd642330bde0f722710b6413d5840c 100644 (file)
@@ -26,9 +26,10 @@ int yylex();
 void yyerror(const char*);
 }
 
-static re2c::uint accept;
-static RegExp *spec;
-static Scanner *in = NULL;
+static re2c::uint       accept;
+static re2c::RegExpMap  specmap;
+static RegExp           *spec;
+static Scanner          *in = NULL;
 
 /* Bison version 1.875 emits a definition that is not working
  * with several g++ version. Hence we disable it here.
@@ -66,12 +67,13 @@ static char* strdup(const char* s)
        int             number;
        re2c::ExtOp     extop;
        re2c::Str       *str;
+       re2c::CondList  *clist;
 };
 
-%token         CLOSESIZE       CLOSE   ID      CODE    RANGE   STRING
+%token         CLOSESIZE       CLOSE   STAR    ID      CODE    RANGE   STRING
 %token         CONFIG  VALUE   NUMBER
 
-%type  <op>            CLOSE
+%type  <op>            CLOSE   STAR
 %type  <op>            close
 %type  <extop>         CLOSESIZE
 %type  <symbol>        ID
@@ -79,6 +81,7 @@ static char* strdup(const char* s)
 %type  <regexp>        RANGE   STRING
 %type  <regexp>        rule    look    expr    diff    term    factor  primary
 %type  <str>           CONFIG  VALUE
+%type   <clist>                cond    clist
 %type  <number>        NUMBER
 
 %%
@@ -90,9 +93,6 @@ spec:
                        spec = NULL;
                }
        |       spec rule
-               {
-                       spec = spec? mkAlt(spec, $2) : $2;
-               }
        |       spec decl
 ;
 
@@ -105,6 +105,10 @@ decl:
                        }
                        $1->re = $3;
                }
+       |       ID '=' expr '/'
+               {
+                       in->fatal("trailing contexts are not allowed in named definitions");
+               }
        |       CONFIG '=' VALUE ';'
                {
                        in->config(*$1, *$3);
@@ -118,17 +122,76 @@ decl:
                }
 ;
 
-decl:
-               ID '=' expr '/'
+rule:
+               expr look CODE
                {
-                       in->fatal("trailing contexts are not allowed in named definitions");
+                       if (cFlag)
+                       {
+                               in->fatal("condition or '<*>' required when using -c switch");
+                       }
+                       $$ = new RuleOp($1, $2, $3, accept++);
+                       spec = spec? mkAlt(spec, $$) : $$;
+               }
+       |       '<' cond '>' expr look CODE
+               {
+                       if (!cFlag)
+                       {
+                               delete $2;
+                               in->fatal("conditions are only allowed when using -c switch");
+                       }
+                       for(CondList::const_iterator it = $2->begin(); it != $2->end(); ++it)
+                       {
+                               // Duplicating stuff, slow but safe
+                               $$ = new RuleOp($4, $5, new Token(*$6), accept++);
+                               
+                               RegExpMap::iterator itRE = specmap.find(*it);
+                               
+                               if (itRE != specmap.end())
+                               {
+                                       $$ = mkAlt(itRE->second, $$);
+                               }
+                               specmap[*it] = $$;
+                       }
+                       delete $2;
+                       delete $6;
+               }
+       |       '<' cond '>' look CODE
+               {
+                       delete $2;
+                       if (!cFlag)
+                       {
+                               in->fatal("conditions are only allowed when using -c switch");
+                       }
+                       in->fatal("no expression specified");
                }
 ;
 
-rule:
-               expr look CODE
+cond:
+               /* empty */
                {
-                       $$ = new RuleOp($1, $2, $3, accept++);
+                       in->fatal("unnamed condition not supported");
+               }
+       |       STAR
+               {
+                       $$ = new CondList();
+                       $$->insert("*");
+               }
+       |       clist
+               {
+                       $$ = $1;
+               }
+       ;
+
+clist:
+               ID
+               {
+                       $$ = new CondList();
+                       $$->insert($1->GetName().to_string());
+               }
+       |       clist ',' ID
+               {
+                       $1->insert($3->GetName().to_string());
+                       $$ = $1;
                }
 ;
 
@@ -211,10 +274,18 @@ close:
                {
                        $$ = $1;
                }
+       |       STAR
+               {
+                       $$ = $1;
+               }
        |       close CLOSE
                {
                        $$ = ($1 == $2) ? $1 : '*';
                }
+       |       close STAR
+               {
+                       $$ = ($1 == $2) ? $1 : '*';
+               }
 ;
 
 primary:
@@ -273,7 +344,19 @@ void parse(Scanner& i, std::ostream& o)
        while(i.echo())
        {
                yyparse();
-               if(spec)
+               if (cFlag)
+               {
+                       for(RegExpMap::const_iterator it = specmap.begin(); it != specmap.end(); ++it)
+                       {
+                               if (it->second)
+                               {
+                                       o << "yyc_" << it->first << ":\n";
+                                       spec = it->second;
+                                       genCode(o, topIndent, spec);
+                               }
+                       }
+               }
+               else if(spec)
                {
                        genCode(o, topIndent, spec);
                }
@@ -283,6 +366,7 @@ void parse(Scanner& i, std::ostream& o)
        RegExp::vFreeList.clear();
        Range::vFreeList.clear();
        Symbol::ClearTable();
+       specmap.clear();
        in = NULL;
 }
 
index 84ccf7a7cde95675eabf02c86c8b16ab9ca137e5..aebab1a387667b290589a76475fd5a16c2ec8281 100644 (file)
@@ -274,11 +274,15 @@ scan:
                                        fatal("unterminated range (missing ])");
                                }
 
-       [()|=;/\\]      {
+       [<>,()|=;/\\]   {
                                        RETURN(*tok);
                                }
 
-       [*+?]           {
+       "*"                     {
+                                       yylval.op = *tok;
+                                       RETURN(STAR);
+                               }
+       [+?]            {
                                        yylval.op = *tok;
                                        RETURN(CLOSE);
                                }
diff --git a/re2c/test/cond_error_00.c b/re2c/test/cond_error_00.c
new file mode 100755 (executable)
index 0000000..7d3ff77
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 10: conditions are only allowed when using -c switch
diff --git a/re2c/test/cond_error_00.re b/re2c/test/cond_error_00.re
new file mode 100755 (executable)
index 0000000..29ab6ca
--- /dev/null
@@ -0,0 +1,6 @@
+/*!re2c
+
+<re>   "a" { }
+<r1,r2>        "b" { }
+
+*/
diff --git a/re2c/test/cond_error_01.c.c b/re2c/test/cond_error_01.c.c
new file mode 100755 (executable)
index 0000000..b6bd832
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 2: unnamed condition not supported
diff --git a/re2c/test/cond_error_01.c.re b/re2c/test/cond_error_01.c.re
new file mode 100755 (executable)
index 0000000..0120999
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<>     "a" { }
+
+*/
diff --git a/re2c/test/cond_error_02.c.c b/re2c/test/cond_error_02.c.c
new file mode 100755 (executable)
index 0000000..1aff9de
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 4: unnamed condition not supported
diff --git a/re2c/test/cond_error_02.c.re b/re2c/test/cond_error_02.c.re
new file mode 100755 (executable)
index 0000000..ae3134b
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<      >       "a" { }
+
+*/
diff --git a/re2c/test/cond_error_03.c.c b/re2c/test/cond_error_03.c.c
new file mode 100755 (executable)
index 0000000..0e580b0
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 5: no expression specified
diff --git a/re2c/test/cond_error_03.c.re b/re2c/test/cond_error_03.c.re
new file mode 100755 (executable)
index 0000000..2535984
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<a>    { }
+
+*/
diff --git a/re2c/test/cond_error_04.c.c b/re2c/test/cond_error_04.c.c
new file mode 100755 (executable)
index 0000000..b6bd832
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 2: unnamed condition not supported
diff --git a/re2c/test/cond_error_04.c.re b/re2c/test/cond_error_04.c.re
new file mode 100755 (executable)
index 0000000..352a7f3
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<,>    { }
+
+*/
diff --git a/re2c/test/cond_error_05.c.c b/re2c/test/cond_error_05.c.c
new file mode 100755 (executable)
index 0000000..b6bd832
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 2: unnamed condition not supported
diff --git a/re2c/test/cond_error_05.c.re b/re2c/test/cond_error_05.c.re
new file mode 100755 (executable)
index 0000000..cd5f980
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<+>    "a" { }
+
+*/
diff --git a/re2c/test/cond_error_06.c.c b/re2c/test/cond_error_06.c.c
new file mode 100755 (executable)
index 0000000..b6bd832
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 2: unnamed condition not supported
diff --git a/re2c/test/cond_error_06.c.re b/re2c/test/cond_error_06.c.re
new file mode 100755 (executable)
index 0000000..99b8cfa
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<?>    "a" { }
+
+*/
diff --git a/re2c/test/cond_error_07.c.c b/re2c/test/cond_error_07.c.c
new file mode 100755 (executable)
index 0000000..24ec535
--- /dev/null
@@ -0,0 +1 @@
+re2c: error: line 3, column 4: syntax error
diff --git a/re2c/test/cond_error_07.c.re b/re2c/test/cond_error_07.c.re
new file mode 100755 (executable)
index 0000000..968f7ac
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+<a,*>  "a" { }
+
+*/
index 330e541acd935d93cb4ba3187cbb4d3ca68e8e04..19a6442052edd9ec69811cc6a2e2bda64acac13a 100644 (file)
@@ -9,16 +9,21 @@ namespace re2c
 
 class Token
 {
-
 public:
-       Str     text;
+       Str     text;
        uint    line;
 
 public:
-       Token(SubStr, uint);
+       Token(const SubStr&, uint);
+       Token(const Token& oth);
 };
 
-inline Token::Token(SubStr t, uint l) : text(t), line(l)
+inline Token::Token(const SubStr& t, uint l) : text(t), line(l)
+{
+       ;
+}
+
+inline Token::Token(const Token& oth) : text(oth.text), line(oth.line)
 {
        ;
 }