]> granicus.if.org Git - re2c/commitdiff
Close: [ 891940 ] braced quantifiers: {\d+(,|,\d+)?} style
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Tue, 30 Mar 2004 00:49:19 +0000 (00:49 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Tue, 30 Mar 2004 00:49:19 +0000 (00:49 +0000)
actions.cc
bootstrap/parser.cc
bootstrap/scanner.cc
bootstrap/y.tab.h
examples/repeater.re [new file with mode: 0755]
parser.y
re.h
scanner.re

index bd82d493807bac661916d664c4bc55e1b7f4e924..c9599e23dc5a24be2450ec8bd803e3df1dc7935a 100644 (file)
@@ -324,6 +324,42 @@ void CloseOp::split(CharSet &s){
     exp->split(s);
 }
 
+char *CloseVOp::type = "CloseVOp";
+
+void CloseVOp::calcSize(Char *rep){
+    exp->calcSize(rep);
+    if(max >= 0)
+      size = (exp->size * min) + ((1 + exp->size) * (max - min));
+    else
+      size = (exp->size * min) + 1;
+}
+
+void CloseVOp::compile(Char *rep, Ins *i){
+    Ins *jumppoint;
+    int st = 0;
+    jumppoint = i + ((1 + exp->size) * (max - min));
+    for(st = min; st < max; st++) {
+      i->i.tag = FORK;
+      i->i.link = jumppoint;
+      i+=1;
+      exp->compile(rep, &i[0]);
+      i += exp->size;
+    }
+    for(st = 0; st < min; st++) {
+      exp->compile(rep, &i[0]);
+      i += exp->size;
+      if(max < 0 && st == 0) {
+        i->i.tag = FORK;
+        i->i.link = i - exp->size;
+        i++;
+      }
+    }
+}
+
+void CloseVOp::split(CharSet &s){
+    exp->split(s);
+}
+
 RegExp *expr(Scanner &);
 
 uchar unescape(SubStr &s){
index 7c20d4173f092639c819e1a57a521c1ca8cafbae..6c4c094e6d2a0448a00c72d7dfbb606b43d2a635 100644 (file)
-/* A Bison parser, made from parser.y
-   by GNU bison 1.35.  */
+/* A Bison parser, made by GNU Bison 1.875.  */
 
-#define YYBISON 1  /* Identify Bison output.  */
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
 
-# define       CLOSE   257
-# define       ID      258
-# define       CODE    259
-# define       RANGE   260
-# define       STRING  261
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* Written by Richard Stallman by simplifying the original so called
+   ``semantic'' parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
 
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Using locations.  */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     CLOSESIZE = 258,
+     CLOSE = 259,
+     ID = 260,
+     CODE = 261,
+     RANGE = 262,
+     STRING = 263
+   };
+#endif
+#define CLOSESIZE 258
+#define CLOSE 259
+#define ID 260
+#define CODE 261
+#define RANGE 262
+#define STRING 263
+
+
+
+
+/* Copy the first part of user declarations.  */
 #line 1 "parser.y"
 
 
 /* $Id$ */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_TIME_H
 #include <time.h>
-#include <iostream.h>
+#endif
+
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
+
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #include "globals.h"
 #include "parser.h"
-#include "version.h"
 
 extern "C"
 {
@@ -41,208 +127,45 @@ static Scanner *in;
 #endif
 
 
-#line 35 "parser.y"
-#ifndef YYSTYPE
-typedef union {
-    Symbol     *symbol;
-    RegExp     *regexp;
-    Token      *token;
-    char       op;
-} yystype;
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
+
+/* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
 #endif
 
-
-
-#define        YYFINAL         32
-#define        YYFLAG          -32768
-#define        YYNTBASE        15
-
-/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 25)
-
-/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
-static const char yytranslate[] =
-{
-       0,     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,     2,     2,     2,     2,
-      13,    14,     2,     2,     2,     2,     2,    10,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     9,
-       2,     8,     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,    12,     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,    11,     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,
-       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,     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,
-       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,     3,     4,     5,
-       6,     7
-};
-
-#if YYDEBUG
-static const short yyprhs[] =
-{
-       0,     0,     1,     4,     7,    12,    16,    17,    20,    22,
-      26,    28,    32,    34,    37,    39,    42,    44,    47,    49,
-      51,    53
-};
-static const short yyrhs[] =
-{
-      -1,    15,    17,     0,    15,    16,     0,     4,     8,    19,
-       9,     0,    19,    18,     5,     0,     0,    10,    19,     0,
-      20,     0,    19,    11,    20,     0,    21,     0,    20,    12,
-      21,     0,    22,     0,    21,    22,     0,    24,     0,    24,
-      23,     0,     3,     0,    23,     3,     0,     4,     0,     6,
-       0,     7,     0,    13,    19,    14,     0
-};
-
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
 #endif
 
-#if YYDEBUG
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const short yyrline[] =
-{
-       0,    53,    56,    58,    61,    67,    71,    73,    77,    79,
-      83,    85,    92,    94,    98,   100,   116,   118,   122,   126,
-     128,   130
-};
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 58 "parser.y"
+typedef union YYSTYPE {
+    Symbol     *symbol;
+    RegExp     *regexp;
+    Token      *token;
+    char       op;
+    ExtOp      extop;
+} YYSTYPE;
+/* Line 191 of yacc.c.  */
+#line 154 "y.tab.c"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
-#if (YYDEBUG) || defined YYERROR_VERBOSE
 
-/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
-static const char *const yytname[] =
-{
-  "$", "error", "$undefined.", "CLOSE", "ID", "CODE", "RANGE", "STRING", 
-  "'='", "';'", "'/'", "'|'", "'\\\\'", "'('", "')'", "spec", "decl", 
-  "rule", "look", "expr", "diff", "term", "factor", "close", "primary", 0
-};
-#endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const short yyr1[] =
-{
-       0,    15,    15,    15,    16,    17,    18,    18,    19,    19,
-      20,    20,    21,    21,    22,    22,    23,    23,    24,    24,
-      24,    24
-};
+/* Copy the second part of user declarations.  */
 
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const short yyr2[] =
-{
-       0,     0,     2,     2,     4,     3,     0,     2,     1,     3,
-       1,     3,     1,     2,     1,     2,     1,     2,     1,     1,
-       1,     3
-};
 
-/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
-   doesn't specify something else to do.  Zero means the default is an
-   error. */
-static const short yydefact[] =
-{
-       1,     0,    18,    19,    20,     0,     3,     2,     6,     8,
-      10,    12,    14,     0,    18,     0,     0,     0,     0,     0,
-      13,    16,    15,     0,    21,     7,     9,     5,    11,    17,
-       4,     0,     0
-};
+/* Line 214 of yacc.c.  */
+#line 166 "y.tab.c"
 
-static const short yydefgoto[] =
-{
-       1,     6,     7,    18,     8,     9,    10,    11,    22,    12
-};
-
-static const short yypact[] =
-{
-  -32768,     1,    -4,-32768,-32768,    13,-32768,-32768,     5,     9,
-      13,-32768,    19,    13,-32768,    -8,    13,    13,     7,    13,
-  -32768,-32768,    20,     0,-32768,    14,     9,-32768,    13,-32768,
-  -32768,    24,-32768
-};
-
-static const short yypgoto[] =
-{
-  -32768,-32768,-32768,-32768,    -3,    10,    11,   -10,-32768,-32768
-};
-
-
-#define        YYLAST          30
-
-
-static const short yytable[] =
-{
-      20,    31,    15,    17,    13,     2,    24,     3,     4,    30,
-      23,    17,    27,    25,     5,    16,    17,    14,    20,     3,
-       4,    19,    21,    29,    32,    17,     5,    26,     0,     0,
-      28
-};
-
-static const short yycheck[] =
-{
-      10,     0,     5,    11,     8,     4,    14,     6,     7,     9,
-      13,    11,     5,    16,    13,    10,    11,     4,    28,     6,
-       7,    12,     3,     3,     0,    11,    13,    17,    -1,    -1,
-      19
-};
-/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/share/bison/bison.simple"
-
-/* Skeleton output parser for bison,
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  */
-
-/* This is the parser code that is written into each bison parser when
-   the %semantic_parser declaration is not specified in the grammar.
-   It was written by Richard Stallman by simplifying the hairy parser
-   used when %semantic_parser is specified.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
+#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
@@ -271,37 +194,28 @@ static const short yycheck[] =
 #  define YYSTACK_ALLOC malloc
 #  define YYSTACK_FREE free
 # endif
-#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
+#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
 
 #if (! defined (yyoverflow) \
      && (! defined (__cplusplus) \
-        || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+        || (YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
   short yyss;
   YYSTYPE yyvs;
-# if YYLSP_NEEDED
-  YYLTYPE yyls;
-# endif
-};
+  };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
 /* The size of an array large to enough to hold all stacks, each with
    N elements.  */
-# if YYLSP_NEEDED
-#  define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))     \
-      + 2 * YYSTACK_GAP_MAX)
-# else
-#  define YYSTACK_BYTES(N) \
+# define YYSTACK_BYTES(N) \
      ((N) * (sizeof (short) + sizeof (YYSTYPE))                                \
-      + YYSTACK_GAP_MAX)
-# endif
+      + YYSTACK_GAP_MAXIMUM)
 
 /* Copy COUNT objects from FROM to TO.  The source and destination do
    not overlap.  */
@@ -332,13 +246,205 @@ union yyalloc
        YYSIZE_T yynewbytes;                                            \
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
        Stack = &yyptr->Stack;                                          \
-       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;   \
+       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
       }                                                                        \
     while (0)
 
 #endif
 
+#if defined (__STDC__) || defined (__cplusplus)
+   typedef signed char yysigned_char;
+#else
+   typedef short yysigned_char;
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL  2
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   28
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS  16
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS  11
+/* YYNRULES -- Number of rules. */
+#define YYNRULES  23
+/* YYNRULES -- Number of states. */
+#define YYNSTATES  33
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   263
+
+#define YYTRANSLATE(YYX)                                               \
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const unsigned char yytranslate[] =
+{
+       0,     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,     2,     2,     2,     2,
+      14,    15,     2,     2,     2,     2,     2,    11,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    10,
+       2,     9,     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,    13,     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,    12,     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,
+       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,     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,
+       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
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const unsigned char yyprhs[] =
+{
+       0,     0,     3,     4,     7,    10,    15,    19,    20,    23,
+      25,    29,    31,    35,    37,    40,    42,    45,    48,    50,
+      53,    55,    57,    59
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yysigned_char yyrhs[] =
+{
+      17,     0,    -1,    -1,    17,    19,    -1,    17,    18,    -1,
+       5,     9,    21,    10,    -1,    21,    20,     6,    -1,    -1,
+      11,    21,    -1,    22,    -1,    21,    12,    22,    -1,    23,
+      -1,    22,    13,    23,    -1,    24,    -1,    23,    24,    -1,
+      26,    -1,    26,    25,    -1,    26,     3,    -1,     4,    -1,
+      25,     4,    -1,     5,    -1,     7,    -1,     8,    -1,    14,
+      21,    15,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const unsigned char yyrline[] =
+{
+       0,    79,    79,    81,    83,    86,    92,    97,    98,   102,
+     104,   108,   110,   117,   119,   123,   125,   139,   145,   147,
+     151,   155,   157,   159
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE
+/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "CLOSESIZE", "CLOSE", "ID", "CODE", 
+  "RANGE", "STRING", "'='", "';'", "'/'", "'|'", "'\\\\'", "'('", "')'", 
+  "$accept", "spec", "decl", "rule", "look", "expr", "diff", "term", 
+  "factor", "close", "primary", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const unsigned short yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,    61,
+      59,    47,   124,    92,    40,    41
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const unsigned char yyr1[] =
+{
+       0,    16,    17,    17,    17,    18,    19,    20,    20,    21,
+      21,    22,    22,    23,    23,    24,    24,    24,    25,    25,
+      26,    26,    26,    26
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const unsigned char yyr2[] =
+{
+       0,     2,     0,     2,     2,     4,     3,     0,     2,     1,
+       3,     1,     3,     1,     2,     1,     2,     2,     1,     2,
+       1,     1,     1,     3
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const unsigned char yydefact[] =
+{
+       2,     0,     1,    20,    21,    22,     0,     4,     3,     7,
+       9,    11,    13,    15,     0,    20,     0,     0,     0,     0,
+       0,    14,    17,    18,    16,     0,    23,     8,    10,     6,
+      12,    19,     5
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yysigned_char yydefgoto[] =
+{
+      -1,     1,     7,     8,    19,     9,    10,    11,    12,    24,
+      13
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -12
+static const yysigned_char yypact[] =
+{
+     -12,     1,   -12,    13,   -12,   -12,     9,   -12,   -12,     0,
+       5,     9,   -12,    17,     9,   -12,    -8,     9,     9,    18,
+       9,   -12,   -12,   -12,    21,    -7,   -12,    14,     5,   -12,
+       9,   -12,   -12
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const yysigned_char yypgoto[] =
+{
+     -12,   -12,   -12,   -12,   -12,    -4,    10,     7,   -11,   -12,
+     -12
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If zero, do what YYDEFACT says.
+   If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -1
+static const unsigned char yytable[] =
+{
+      21,     2,    16,    32,    18,    18,     3,    26,     4,     5,
+      25,    17,    18,    27,    15,     6,     4,     5,    20,    21,
+      22,    23,    14,     6,    29,    31,    18,    30,    28
+};
+
+static const unsigned char yycheck[] =
+{
+      11,     0,     6,    10,    12,    12,     5,    15,     7,     8,
+      14,    11,    12,    17,     5,    14,     7,     8,    13,    30,
+       3,     4,     9,    14,     6,     4,    12,    20,    18
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const unsigned char yystos[] =
+{
+       0,    17,     0,     5,     7,     8,    14,    18,    19,    21,
+      22,    23,    24,    26,     9,     5,    21,    11,    12,    20,
+      13,    24,     3,     4,    25,    21,    15,    21,    22,     6,
+      23,     4,    10
+};
 
 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 # define YYSIZE_T __SIZE_TYPE__
@@ -358,29 +464,35 @@ union yyalloc
 
 #define yyerrok                (yyerrstatus = 0)
 #define yyclearin      (yychar = YYEMPTY)
-#define YYEMPTY                -2
+#define YYEMPTY                (-2)
 #define YYEOF          0
+
 #define YYACCEPT       goto yyacceptlab
-#define YYABORT        goto yyabortlab
+#define YYABORT                goto yyabortlab
 #define YYERROR                goto yyerrlab1
+
+
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
    Once GCC version 2 has supplanted version 1, this can go.  */
+
 #define YYFAIL         goto yyerrlab
+
 #define YYRECOVERING()  (!!yyerrstatus)
+
 #define YYBACKUP(Token, Value)                                 \
 do                                                             \
   if (yychar == YYEMPTY && yylen == 1)                         \
     {                                                          \
       yychar = (Token);                                                \
       yylval = (Value);                                                \
-      yychar1 = YYTRANSLATE (yychar);                          \
+      yytoken = YYTRANSLATE (yychar);                          \
       YYPOPSTACK;                                              \
       goto yybackup;                                           \
     }                                                          \
   else                                                         \
     {                                                          \
-      yyerror ("syntax error: cannot back up");                        \
+      yyerror ("syntax error: cannot back up");\
       YYERROR;                                                 \
     }                                                          \
 while (0)
@@ -388,41 +500,24 @@ while (0)
 #define YYTERROR       1
 #define YYERRCODE      256
 
-
 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
-   are run).
-
-   When YYLLOC_DEFAULT is run, CURRENT is set the location of the
-   first token.  By default, to implement support for ranges, extend
-   its range to the last symbol.  */
+   are run).  */
 
 #ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)               \
-   Current.last_line   = Rhs[N].last_line;     \
-   Current.last_column = Rhs[N].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N)         \
+  Current.first_line   = Rhs[1].first_line;      \
+  Current.first_column = Rhs[1].first_column;    \
+  Current.last_line    = Rhs[N].last_line;       \
+  Current.last_column  = Rhs[N].last_column;
 #endif
 
-
 /* YYLEX -- calling `yylex' with the right arguments.  */
 
-#if YYPURE
-# if YYLSP_NEEDED
-#  ifdef YYLEX_PARAM
-#   define YYLEX               yylex (&yylval, &yylloc, YYLEX_PARAM)
-#  else
-#   define YYLEX               yylex (&yylval, &yylloc)
-#  endif
-# else /* !YYLSP_NEEDED */
-#  ifdef YYLEX_PARAM
-#   define YYLEX               yylex (&yylval, YYLEX_PARAM)
-#  else
-#   define YYLEX               yylex (&yylval)
-#  endif
-# endif /* !YYLSP_NEEDED */
-#else /* !YYPURE */
-# define YYLEX                 yylex ()
-#endif /* !YYPURE */
-
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
 
 /* Enable debugging if requested.  */
 #if YYDEBUG
@@ -437,13 +532,93 @@ do {                                              \
   if (yydebug)                                 \
     YYFPRINTF Args;                            \
 } while (0)
+
+# define YYDSYMPRINT(Args)                     \
+do {                                           \
+  if (yydebug)                                 \
+    yysymprint Args;                           \
+} while (0)
+
+# define YYDSYMPRINTF(Title, Token, Value, Location)           \
+do {                                                           \
+  if (yydebug)                                                 \
+    {                                                          \
+      YYFPRINTF (stderr, "%s ", Title);                                \
+      yysymprint (stderr,                                      \
+                  Token, Value);       \
+      YYFPRINTF (stderr, "\n");                                        \
+    }                                                          \
+} while (0)
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (cinluded).                                                   |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_stack_print (short *bottom, short *top)
+#else
+static void
+yy_stack_print (bottom, top)
+    short *bottom;
+    short *top;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (/* Nothing. */; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                           \
+do {                                                           \
+  if (yydebug)                                                 \
+    yy_stack_print ((Bottom), (Top));                          \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_reduce_print (int yyrule)
+#else
+static void
+yy_reduce_print (yyrule)
+    int yyrule;
+#endif
+{
+  int yyi;
+  unsigned int yylineno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+             yyrule - 1, yylineno);
+  /* Print the symbols being reduced, and their result.  */
+  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
+    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
+  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
+}
+
+# define YY_REDUCE_PRINT(Rule)         \
+do {                                   \
+  if (yydebug)                         \
+    yy_reduce_print (Rule);            \
+} while (0)
+
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
 int yydebug;
 #else /* !YYDEBUG */
 # define YYDPRINTF(Args)
+# define YYDSYMPRINT(Args)
+# define YYDSYMPRINTF(Title, Token, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
 #endif /* !YYDEBUG */
 
+
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
 #ifndef        YYINITDEPTH
 # define YYINITDEPTH 200
@@ -463,8 +638,10 @@ int yydebug;
 #ifndef YYMAXDEPTH
 # define YYMAXDEPTH 10000
 #endif
+
 \f
-#ifdef YYERROR_VERBOSE
+
+#if YYERROR_VERBOSE
 
 # ifndef yystrlen
 #  if defined (__GLIBC__) && defined (_STRING_H)
@@ -514,86 +691,134 @@ yystpcpy (yydest, yysrc)
 }
 #  endif
 # endif
-#endif
+
+#endif /* !YYERROR_VERBOSE */
+
 \f
-#line 315 "/usr/share/bison/bison.simple"
 
+#if YYDEBUG
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yysymprint (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  /* Pacify ``unused variable'' warnings.  */
+  (void) yyvaluep;
 
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
-   into yyparse.  The argument should have type void *.
-   It should actually point to an object.
-   Grammar actions can access the variable by casting it
-   to the proper pointer type.  */
+  if (yytype < YYNTOKENS)
+    {
+      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+# ifdef YYPRINT
+      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+    }
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  switch (yytype)
+    {
+      default:
+        break;
+    }
+  YYFPRINTF (yyoutput, ")");
+}
+
+#endif /* ! YYDEBUG */
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yydestruct (int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yytype, yyvaluep)
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  /* Pacify ``unused variable'' warnings.  */
+  (void) yyvaluep;
+
+  switch (yytype)
+    {
+
+      default:
+        break;
+    }
+}
+\f
+
+/* Prevent warnings from -Wmissing-prototypes.  */
 
 #ifdef YYPARSE_PARAM
 # if defined (__STDC__) || defined (__cplusplus)
-#  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#  define YYPARSE_PARAM_DECL
+int yyparse (void *YYPARSE_PARAM);
 # else
-#  define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+int yyparse ();
 # endif
-#else /* !YYPARSE_PARAM */
-# define YYPARSE_PARAM_ARG
-# define YYPARSE_PARAM_DECL
-#endif /* !YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-# ifdef YYPARSE_PARAM
-int yyparse (void *);
-# else
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
 int yyparse (void);
-# endif
+#else
+int yyparse ();
 #endif
+#endif /* ! YYPARSE_PARAM */
 
-/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
-   variables are global, or local to YYPARSE.  */
-
-#define YY_DECL_NON_LSP_VARIABLES                      \
-/* The lookahead symbol.  */                           \
-int yychar;                                            \
-                                                       \
-/* The semantic value of the lookahead symbol. */      \
-YYSTYPE yylval;                                                \
-                                                       \
-/* Number of parse errors so far.  */                  \
-int yynerrs;
 
-#if YYLSP_NEEDED
-# define YY_DECL_VARIABLES                     \
-YY_DECL_NON_LSP_VARIABLES                      \
-                                               \
-/* Location data for the lookahead symbol.  */ \
-YYLTYPE yylloc;
-#else
-# define YY_DECL_VARIABLES                     \
-YY_DECL_NON_LSP_VARIABLES
-#endif
+
+/* The lookahead symbol.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far.  */
+int yynerrs;
 
 
-/* If nonreentrant, generate the variables here. */
 
-#if !YYPURE
-YY_DECL_VARIABLES
-#endif  /* !YYPURE */
+/*----------.
+| yyparse.  |
+`----------*/
 
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM)
+# else
+int yyparse (YYPARSE_PARAM)
+  void *YYPARSE_PARAM;
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
 int
-yyparse (YYPARSE_PARAM_ARG)
-     YYPARSE_PARAM_DECL
-{
-  /* If reentrant, generate the variables here. */
-#if YYPURE
-  YY_DECL_VARIABLES
-#endif  /* !YYPURE */
+yyparse (void)
+#else
+int
+yyparse ()
 
+#endif
+#endif
+{
+  
   register int yystate;
   register int yyn;
   int yyresult;
   /* Number of tokens to shift before error messages enabled.  */
   int yyerrstatus;
   /* Lookahead token as an internal (translated) token number.  */
-  int yychar1 = 0;
+  int yytoken = 0;
 
   /* Three stacks and their tools:
      `yyss': related to states,
@@ -603,7 +828,7 @@ yyparse (YYPARSE_PARAM_ARG)
      Refer to the stacks thru separate pointers, to allow yyoverflow
      to reallocate them elsewhere.  */
 
-  /* The state stack. */
+  /* The state stack.  */
   short        yyssa[YYINITDEPTH];
   short *yyss = yyssa;
   register short *yyssp;
@@ -613,31 +838,19 @@ yyparse (YYPARSE_PARAM_ARG)
   YYSTYPE *yyvs = yyvsa;
   register YYSTYPE *yyvsp;
 
-#if YYLSP_NEEDED
-  /* The location stack.  */
-  YYLTYPE yylsa[YYINITDEPTH];
-  YYLTYPE *yyls = yylsa;
-  YYLTYPE *yylsp;
-#endif
 
-#if YYLSP_NEEDED
-# define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
-#else
-# define YYPOPSTACK   (yyvsp--, yyssp--)
-#endif
 
-  YYSIZE_T yystacksize = YYINITDEPTH;
+#define YYPOPSTACK   (yyvsp--, yyssp--)
 
+  YYSIZE_T yystacksize = YYINITDEPTH;
 
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
-#if YYLSP_NEEDED
-  YYLTYPE yyloc;
-#endif
+
 
   /* When reducing, the number of symbols on the RHS of the reduced
-     rule. */
+     rule.  */
   int yylen;
 
   YYDPRINTF ((stderr, "Starting parse\n"));
@@ -654,9 +867,7 @@ yyparse (YYPARSE_PARAM_ARG)
 
   yyssp = yyss;
   yyvsp = yyvs;
-#if YYLSP_NEEDED
-  yylsp = yyls;
-#endif
+
   goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -671,7 +882,7 @@ yyparse (YYPARSE_PARAM_ARG)
  yysetstate:
   *yyssp = yystate;
 
-  if (yyssp >= yyss + yystacksize - 1)
+  if (yyss + yystacksize - 1 <= yyssp)
     {
       /* Get the current used size of the three stacks, in elements.  */
       YYSIZE_T yysize = yyssp - yyss + 1;
@@ -684,24 +895,17 @@ yyparse (YYPARSE_PARAM_ARG)
        YYSTYPE *yyvs1 = yyvs;
        short *yyss1 = yyss;
 
+
        /* Each stack pointer address is followed by the size of the
-          data in use in that stack, in bytes.  */
-# if YYLSP_NEEDED
-       YYLTYPE *yyls1 = yyls;
-       /* This used to be a conditional around just the two extra args,
-          but that might be undefined if yyoverflow is a macro.  */
-       yyoverflow ("parser stack overflow",
-                   &yyss1, yysize * sizeof (*yyssp),
-                   &yyvs1, yysize * sizeof (*yyvsp),
-                   &yyls1, yysize * sizeof (*yylsp),
-                   &yystacksize);
-       yyls = yyls1;
-# else
+          data in use in that stack, in bytes.  This used to be a
+          conditional around just the two extra args, but that might
+          be undefined if yyoverflow is a macro.  */
        yyoverflow ("parser stack overflow",
                    &yyss1, yysize * sizeof (*yyssp),
                    &yyvs1, yysize * sizeof (*yyvsp),
+
                    &yystacksize);
-# endif
+
        yyss = yyss1;
        yyvs = yyvs1;
       }
@@ -710,10 +914,10 @@ yyparse (YYPARSE_PARAM_ARG)
       goto yyoverflowlab;
 # else
       /* Extend the stack our own way.  */
-      if (yystacksize >= YYMAXDEPTH)
+      if (YYMAXDEPTH <= yystacksize)
        goto yyoverflowlab;
       yystacksize *= 2;
-      if (yystacksize > YYMAXDEPTH)
+      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;
 
       {
@@ -724,10 +928,8 @@ yyparse (YYPARSE_PARAM_ARG)
          goto yyoverflowlab;
        YYSTACK_RELOCATE (yyss);
        YYSTACK_RELOCATE (yyvs);
-# if YYLSP_NEEDED
-       YYSTACK_RELOCATE (yyls);
-# endif
-# undef YYSTACK_RELOCATE
+
+#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
       }
@@ -736,14 +938,12 @@ yyparse (YYPARSE_PARAM_ARG)
 
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
-#if YYLSP_NEEDED
-      yylsp = yyls + yysize - 1;
-#endif
+
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                  (unsigned long int) yystacksize));
 
-      if (yyssp >= yyss + yystacksize - 1)
+      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
     }
 
@@ -751,7 +951,6 @@ yyparse (YYPARSE_PARAM_ARG)
 
   goto yybackup;
 
-
 /*-----------.
 | yybackup.  |
 `-----------*/
@@ -764,88 +963,55 @@ yybackup:
   /* First try to decide what to do without reference to lookahead token.  */
 
   yyn = yypact[yystate];
-  if (yyn == YYFLAG)
+  if (yyn == YYPACT_NINF)
     goto yydefault;
 
   /* Not known => get a lookahead token if don't already have one.  */
 
-  /* yychar is either YYEMPTY or YYEOF
-     or a valid token in external form.  */
-
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
       yychar = YYLEX;
     }
 
-  /* Convert token to internal form (in yychar1) for indexing tables with */
-
-  if (yychar <= 0)             /* This means end of input. */
+  if (yychar <= YYEOF)
     {
-      yychar1 = 0;
-      yychar = YYEOF;          /* Don't call YYLEX any more */
-
+      yychar = yytoken = YYEOF;
       YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
   else
     {
-      yychar1 = YYTRANSLATE (yychar);
-
-#if YYDEBUG
-     /* We have to keep this `#if YYDEBUG', since we use variables
-       which are defined only if `YYDEBUG' is set.  */
-      if (yydebug)
-       {
-         YYFPRINTF (stderr, "Next token is %d (%s",
-                    yychar, yytname[yychar1]);
-         /* Give the individual parser a way to print the precise
-            meaning of a token, for further debugging info.  */
-# ifdef YYPRINT
-         YYPRINT (stderr, yychar, yylval);
-# endif
-         YYFPRINTF (stderr, ")\n");
-       }
-#endif
+      yytoken = YYTRANSLATE (yychar);
+      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
     }
 
-  yyn += yychar1;
-  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
     goto yydefault;
-
   yyn = yytable[yyn];
-
-  /* yyn is what to do for this token type in this state.
-     Negative => reduce, -yyn is rule number.
-     Positive => shift, yyn is new state.
-       New state is final state => don't bother to shift,
-       just return success.
-     0, or most negative number => error.  */
-
-  if (yyn < 0)
+  if (yyn <= 0)
     {
-      if (yyn == YYFLAG)
+      if (yyn == 0 || yyn == YYTABLE_NINF)
        goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
-  else if (yyn == 0)
-    goto yyerrlab;
 
   if (yyn == YYFINAL)
     YYACCEPT;
 
   /* Shift the lookahead token.  */
-  YYDPRINTF ((stderr, "Shifting token %d (%s), ",
-             yychar, yytname[yychar1]));
+  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
 
   /* Discard the token being shifted unless it is eof.  */
   if (yychar != YYEOF)
     yychar = YYEMPTY;
 
   *++yyvsp = yylval;
-#if YYLSP_NEEDED
-  *++yylsp = yylloc;
-#endif
+
 
   /* Count tokens shifted since error; after three, turn off error
      status.  */
@@ -876,100 +1042,91 @@ yyreduce:
   /* If YYLEN is nonzero, implement the default value of the action:
      `$$ = $1'.
 
-     Otherwise, the following line sets YYVAL to the semantic value of
-     the lookahead token.  This behavior is undocumented and Bison
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
      users should not rely upon it.  Assigning to YYVAL
      unconditionally makes the parser a bit smaller, and it avoids a
      GCC warning that YYVAL may be used uninitialized.  */
   yyval = yyvsp[1-yylen];
 
-#if YYLSP_NEEDED
-  /* Similarly for the default location.  Let the user run additional
-     commands if for instance locations are ranges.  */
-  yyloc = yylsp[1-yylen];
-  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
-#endif
 
-#if YYDEBUG
-  /* We have to keep this `#if YYDEBUG', since we use variables which
-     are defined only if `YYDEBUG' is set.  */
-  if (yydebug)
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
     {
-      int yyi;
-
-      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
-                yyn, yyrline[yyn]);
-
-      /* Print the symbols being reduced, and their result.  */
-      for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
-       YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
-      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
-    }
-#endif
-
-  switch (yyn) {
-
-case 1:
-#line 54 "parser.y"
-{ accept = 0;
+        case 2:
+#line 79 "parser.y"
+    { accept = 0;
                  spec = NULL; }
     break;
-case 2:
-#line 57 "parser.y"
-{ spec = spec? mkAlt(spec, yyvsp[0].regexp) : yyvsp[0].regexp; }
+
+  case 3:
+#line 82 "parser.y"
+    { spec = spec? mkAlt(spec, yyvsp[0].regexp) : yyvsp[0].regexp; }
     break;
-case 4:
-#line 62 "parser.y"
-{ if(yyvsp[-3].symbol->re)
+
+  case 5:
+#line 87 "parser.y"
+    { if(yyvsp[-3].symbol->re)
                      in->fatal("sym already defined");
                  yyvsp[-3].symbol->re = yyvsp[-1].regexp; }
     break;
-case 5:
-#line 68 "parser.y"
-{ yyval.regexp = new RuleOp(yyvsp[-2].regexp, yyvsp[-1].regexp, yyvsp[0].token, accept++); }
+
+  case 6:
+#line 93 "parser.y"
+    { yyval.regexp = new RuleOp(yyvsp[-2].regexp, yyvsp[-1].regexp, yyvsp[0].token, accept++); }
     break;
-case 6:
-#line 72 "parser.y"
-{ yyval.regexp = new NullOp; }
+
+  case 7:
+#line 97 "parser.y"
+    { yyval.regexp = new NullOp; }
     break;
-case 7:
-#line 74 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 8:
+#line 99 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 8:
-#line 78 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 9:
+#line 103 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 9:
-#line 80 "parser.y"
-{ yyval.regexp =  mkAlt(yyvsp[-2].regexp, yyvsp[0].regexp); }
+
+  case 10:
+#line 105 "parser.y"
+    { yyval.regexp =  mkAlt(yyvsp[-2].regexp, yyvsp[0].regexp); }
     break;
-case 10:
-#line 84 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 11:
+#line 109 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 11:
-#line 86 "parser.y"
-{ yyval.regexp =  mkDiff(yyvsp[-2].regexp, yyvsp[0].regexp);
+
+  case 12:
+#line 111 "parser.y"
+    { yyval.regexp =  mkDiff(yyvsp[-2].regexp, yyvsp[0].regexp);
                  if(!yyval.regexp)
                       in->fatal("can only difference char sets");
                }
     break;
-case 12:
-#line 93 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 13:
+#line 118 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 13:
-#line 95 "parser.y"
-{ yyval.regexp = new CatOp(yyvsp[-1].regexp, yyvsp[0].regexp); }
+
+  case 14:
+#line 120 "parser.y"
+    { yyval.regexp = new CatOp(yyvsp[-1].regexp, yyvsp[0].regexp); }
     break;
-case 14:
-#line 99 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 15:
+#line 124 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 15:
-#line 101 "parser.y"
-{
+
+  case 16:
+#line 126 "parser.y"
+    {
                    switch(yyvsp[0].op){
                    case '*':
                        yyval.regexp = mkAlt(new CloseOp(yyvsp[-1].regexp), new NullOp());
@@ -983,58 +1140,60 @@ case 15:
                    }
                }
     break;
-case 16:
-#line 117 "parser.y"
-{ yyval.op = yyvsp[0].op; }
+
+  case 17:
+#line 140 "parser.y"
+    {
+                       yyval.regexp = new CloseVOp(yyvsp[-1].regexp, yyvsp[0].extop.minsize, yyvsp[0].extop.maxsize);
+               }
     break;
-case 17:
-#line 119 "parser.y"
-{ yyval.op = (yyvsp[-1].op == yyvsp[0].op) ? yyvsp[-1].op : '*'; }
+
+  case 18:
+#line 146 "parser.y"
+    { yyval.op = yyvsp[0].op; }
+    break;
+
+  case 19:
+#line 148 "parser.y"
+    { yyval.op = (yyvsp[-1].op == yyvsp[0].op) ? yyvsp[-1].op : '*'; }
     break;
-case 18:
-#line 123 "parser.y"
-{ if(!yyvsp[0].symbol->re)
+
+  case 20:
+#line 152 "parser.y"
+    { if(!yyvsp[0].symbol->re)
                      in->fatal("can't find symbol");
                  yyval.regexp = yyvsp[0].symbol->re; }
     break;
-case 19:
-#line 127 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 21:
+#line 156 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 20:
-#line 129 "parser.y"
-{ yyval.regexp = yyvsp[0].regexp; }
+
+  case 22:
+#line 158 "parser.y"
+    { yyval.regexp = yyvsp[0].regexp; }
     break;
-case 21:
-#line 131 "parser.y"
-{ yyval.regexp = yyvsp[-1].regexp; }
+
+  case 23:
+#line 160 "parser.y"
+    { yyval.regexp = yyvsp[-1].regexp; }
     break;
-}
 
-#line 705 "/usr/share/bison/bison.simple"
 
+    }
+
+/* Line 999 of yacc.c.  */
+#line 1187 "y.tab.c"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
-#if YYLSP_NEEDED
-  yylsp -= yylen;
-#endif
 
-#if YYDEBUG
-  if (yydebug)
-    {
-      short *yyssp1 = yyss - 1;
-      YYFPRINTF (stderr, "state stack now");
-      while (yyssp1 != yyssp)
-       YYFPRINTF (stderr, " %d", *++yyssp1);
-      YYFPRINTF (stderr, "\n");
-    }
-#endif
+
+  YY_STACK_PRINT (yyss, yyssp);
 
   *++yyvsp = yyval;
-#if YYLSP_NEEDED
-  *++yylsp = yyloc;
-#endif
+
 
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
@@ -1042,11 +1201,11 @@ case 21:
 
   yyn = yyr1[yyn];
 
-  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
-  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
     yystate = yytable[yystate];
   else
-    yystate = yydefgoto[yyn - YYNTBASE];
+    yystate = yydefgoto[yyn - YYNTOKENS];
 
   goto yynewstate;
 
@@ -1059,13 +1218,13 @@ yyerrlab:
   if (!yyerrstatus)
     {
       ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
+#if YYERROR_VERBOSE
       yyn = yypact[yystate];
 
-      if (yyn > YYFLAG && yyn < YYLAST)
+      if (YYPACT_NINF < yyn && yyn < YYLAST)
        {
          YYSIZE_T yysize = 0;
+         int yytype = YYTRANSLATE (yychar);
          char *yymsg;
          int yyx, yycount;
 
@@ -1074,15 +1233,15 @@ yyerrlab:
             YYCHECK.  */
          for (yyx = yyn < 0 ? -yyn : 0;
               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
-           if (yycheck[yyx + yyn] == yyx)
+           if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
-         yysize += yystrlen ("parse error, unexpected ") + 1;
-         yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
+         yysize += yystrlen ("syntax error, unexpected ") + 1;
+         yysize += yystrlen (yytname[yytype]);
          yymsg = (char *) YYSTACK_ALLOC (yysize);
          if (yymsg != 0)
            {
-             char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
-             yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
+             char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
+             yyp = yystpcpy (yyp, yytname[yytype]);
 
              if (yycount < 5)
                {
@@ -1090,7 +1249,7 @@ yyerrlab:
                  for (yyx = yyn < 0 ? -yyn : 0;
                       yyx < (int) (sizeof (yytname) / sizeof (char *));
                       yyx++)
-                   if (yycheck[yyx + yyn] == yyx)
+                   if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
                      {
                        const char *yyq = ! yycount ? ", expecting " : " or ";
                        yyp = yystpcpy (yyp, yyq);
@@ -1102,102 +1261,77 @@ yyerrlab:
              YYSTACK_FREE (yymsg);
            }
          else
-           yyerror ("parse error; also virtual memory exhausted");
+           yyerror ("syntax error; also virtual memory exhausted");
        }
       else
-#endif /* defined (YYERROR_VERBOSE) */
-       yyerror ("parse error");
+#endif /* YYERROR_VERBOSE */
+       yyerror ("syntax error");
     }
-  goto yyerrlab1;
 
 
-/*--------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action |
-`--------------------------------------------------*/
-yyerrlab1:
+
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */
 
-      /* return failure if at end of input */
+      /* Return failure if at end of input.  */
       if (yychar == YYEOF)
-       YYABORT;
-      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
-                 yychar, yytname[yychar1]));
+        {
+         /* Pop the error token.  */
+          YYPOPSTACK;
+         /* Pop the rest of the stack.  */
+         while (yyss < yyssp)
+           {
+             YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+             yydestruct (yystos[*yyssp], yyvsp);
+             YYPOPSTACK;
+           }
+         YYABORT;
+        }
+
+      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
+      yydestruct (yytoken, &yylval);
       yychar = YYEMPTY;
+
     }
 
   /* Else will try to reuse lookahead token after shifting the error
      token.  */
-
-  yyerrstatus = 3;             /* Each real token shifted decrements this */
-
-  goto yyerrhandle;
-
-
-/*-------------------------------------------------------------------.
-| yyerrdefault -- current state does not do anything special for the |
-| error token.                                                       |
-`-------------------------------------------------------------------*/
-yyerrdefault:
-#if 0
-  /* This is wrong; only states that explicitly want error tokens
-     should shift them.  */
-
-  /* If its default is to accept any token, ok.  Otherwise pop it.  */
-  yyn = yydefact[yystate];
-  if (yyn)
-    goto yydefault;
-#endif
+  goto yyerrlab1;
 
 
-/*---------------------------------------------------------------.
-| yyerrpop -- pop the current state because it cannot handle the |
-| error token                                                    |
-`---------------------------------------------------------------*/
-yyerrpop:
-  if (yyssp == yyss)
-    YYABORT;
-  yyvsp--;
-  yystate = *--yyssp;
-#if YYLSP_NEEDED
-  yylsp--;
-#endif
+/*----------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action.  |
+`----------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
 
-#if YYDEBUG
-  if (yydebug)
+  for (;;)
     {
-      short *yyssp1 = yyss - 1;
-      YYFPRINTF (stderr, "Error: state stack now");
-      while (yyssp1 != yyssp)
-       YYFPRINTF (stderr, " %d", *++yyssp1);
-      YYFPRINTF (stderr, "\n");
-    }
-#endif
+      yyn = yypact[yystate];
+      if (yyn != YYPACT_NINF)
+       {
+         yyn += YYTERROR;
+         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+           {
+             yyn = yytable[yyn];
+             if (0 < yyn)
+               break;
+           }
+       }
 
-/*--------------.
-| yyerrhandle.  |
-`--------------*/
-yyerrhandle:
-  yyn = yypact[yystate];
-  if (yyn == YYFLAG)
-    goto yyerrdefault;
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+       YYABORT;
 
-  yyn += YYTERROR;
-  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
-    goto yyerrdefault;
+      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+      yydestruct (yystos[yystate], yyvsp);
+      yyvsp--;
+      yystate = *--yyssp;
 
-  yyn = yytable[yyn];
-  if (yyn < 0)
-    {
-      if (yyn == YYFLAG)
-       goto yyerrpop;
-      yyn = -yyn;
-      goto yyreduce;
+      YY_STACK_PRINT (yyss, yyssp);
     }
-  else if (yyn == 0)
-    goto yyerrpop;
 
   if (yyn == YYFINAL)
     YYACCEPT;
@@ -1205,9 +1339,7 @@ yyerrhandle:
   YYDPRINTF ((stderr, "Shifting error token, "));
 
   *++yyvsp = yylval;
-#if YYLSP_NEEDED
-  *++yylsp = yylloc;
-#endif
+
 
   yystate = yyn;
   goto yynewstate;
@@ -1227,13 +1359,15 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-/*---------------------------------------------.
-| yyoverflowab -- parser overflow comes here.  |
-`---------------------------------------------*/
+#ifndef yyoverflow
+/*----------------------------------------------.
+| yyoverflowlab -- parser overflow comes here.  |
+`----------------------------------------------*/
 yyoverflowlab:
   yyerror ("parser stack overflow");
   yyresult = 2;
   /* Fall through.  */
+#endif
 
 yyreturn:
 #ifndef yyoverflow
@@ -1242,7 +1376,9 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 134 "parser.y"
+
+
+#line 163 "parser.y"
 
 
 extern "C" {
@@ -1280,7 +1416,7 @@ void line_source(unsigned int line, ostream& o)
 
 void parse(int i, ostream &o){
 
-    o << "/* Generated by re2c " RE2C_VERSION " on ";
+    o << "/* Generated by re2c " PACKAGE_VERSION " on ";
     time_t now = time(&now);
     o.write(ctime(&now), 24);
     o << " */\n";
@@ -1297,3 +1433,4 @@ void parse(int i, ostream &o){
        line_source(in->line(), o);
     }
 }
+
index 9ed57b1f2c20ebf3543ccdfcd615569d1bdad38e..7f2941401ee6c82f3e58cd026c817aa2514a800c 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.2 on Sat Jan 31 10:43:47 2004 */
+/* Generated by re2c 0.9.2 on Sun Mar 14 23:47:55 2004 */
 #line 1 "scanner.re"
 /* $Id$ */
 #include <stdlib.h>
 
 extern YYSTYPE yylval;
 
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
 #define        BSIZE   8192
 
 #define        YYCTYPE         char
@@ -59,7 +63,7 @@ char *Scanner::fill(char *cursor){
     return cursor;
 }
 
-#line 69 "scanner.re"
+#line 73 "scanner.re"
 
 
 int Scanner::echo(ostream &out){
@@ -89,15 +93,15 @@ yy2:        yyaccept = 0;
        if(yych == '*') goto yy7;
        goto yy3;
 yy3:
-#line 88 "scanner.re"
+#line 92 "scanner.re"
 { goto echo; }
 #line 26 "re2c-output.c"
 yy4:   yych = *++YYCURSOR;
        goto yy5;
 yy5:
-#line 84 "scanner.re"
+#line 88 "scanner.re"
 { if(cursor == eof) RETURN(0);
-                                 out.write((const char*)(tok), cursor - tok);
+                                 out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                  tok = pos = cursor; cline++;
                                  goto echo; }
 #line 35 "re2c-output.c"
@@ -125,13 +129,13 @@ yy12:     yych = *++YYCURSOR;
 yy13:  yych = *++YYCURSOR;
        goto yy14;
 yy14:
-#line 81 "scanner.re"
-{ out.write((const char*)(tok), &cursor[-7] - tok);
+#line 85 "scanner.re"
+{ out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
                                  tok = cursor;
                                  RETURN(1); }
 #line 64 "re2c-output.c"
 }
-#line 89 "scanner.re"
+#line 93 "scanner.re"
 
 }
 
@@ -199,45 +203,48 @@ yy15:
                        }
                }
        }
-yy17:  yych = *++YYCURSOR;
+yy17:  yyaccept = 0;
+       yych = *(YYMARKER = ++YYCURSOR);
+       if(yych <= '/') goto yy18;
+       if(yych <= '9') goto yy56;
        goto yy18;
 yy18:
-#line 102 "scanner.re"
+#line 106 "scanner.re"
 { depth = 1;
                                  goto code;
                                }
-#line 129 "re2c-output.c"
+#line 132 "re2c-output.c"
 yy19:  yych = *++YYCURSOR;
        if(yych == '*') goto yy54;
        goto yy20;
 yy20:
-#line 121 "scanner.re"
+#line 125 "scanner.re"
 { RETURN(*tok); }
-#line 136 "re2c-output.c"
+#line 139 "re2c-output.c"
 yy21:  yych = *++YYCURSOR;
        if(yych == '/') goto yy52;
        goto yy22;
 yy22:
-#line 123 "scanner.re"
+#line 127 "scanner.re"
 { yylval.op = *tok;
                                  RETURN(CLOSE); }
-#line 144 "re2c-output.c"
-yy23:  yyaccept = 0;
+#line 147 "re2c-output.c"
+yy23:  yyaccept = 1;
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych != '\n')        goto yy48;
        goto yy24;
 yy24:
-#line 114 "scanner.re"
+#line 118 "scanner.re"
 { fatal("bad string"); }
-#line 152 "re2c-output.c"
-yy25:  yyaccept = 1;
+#line 155 "re2c-output.c"
+yy25:  yyaccept = 2;
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych != '\n')        goto yy42;
        goto yy26;
 yy26:
-#line 119 "scanner.re"
+#line 123 "scanner.re"
 { fatal("bad character constant"); }
-#line 160 "re2c-output.c"
+#line 163 "re2c-output.c"
 yy27:  yych = *++YYCURSOR;
        goto yy20;
 yy28:  yych = *++YYCURSOR;
@@ -245,34 +252,34 @@ yy28:     yych = *++YYCURSOR;
 yy29:  yych = *++YYCURSOR;
        goto yy40;
 yy30:
-#line 126 "scanner.re"
+#line 142 "scanner.re"
 { cur = cursor;
                                  yylval.symbol = Symbol::find(token());
                                  return ID; }
-#line 172 "re2c-output.c"
+#line 175 "re2c-output.c"
 yy31:  yych = *++YYCURSOR;
        goto yy38;
 yy32:
-#line 130 "scanner.re"
+#line 146 "scanner.re"
 { goto scan; }
-#line 178 "re2c-output.c"
+#line 181 "re2c-output.c"
 yy33:  yych = *++YYCURSOR;
        goto yy34;
 yy34:
-#line 132 "scanner.re"
+#line 148 "scanner.re"
 { if(cursor == eof) RETURN(0);
                                  pos = cursor; cline++;
                                  goto scan;
                                }
-#line 187 "re2c-output.c"
+#line 190 "re2c-output.c"
 yy35:  yych = *++YYCURSOR;
        goto yy36;
 yy36:
-#line 137 "scanner.re"
+#line 153 "scanner.re"
 { cerr << "unexpected character: " << *tok << endl;
                                  goto scan;
                                }
-#line 195 "re2c-output.c"
+#line 198 "re2c-output.c"
 yy37:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
@@ -308,8 +315,9 @@ yy42:       if(yych <= '['){
        }
 yy43:  YYCURSOR = YYMARKER;
        switch(yyaccept){
-       case 0: goto yy24;
-       case 1: goto yy26;
+       case 0: goto yy18;
+       case 1: goto yy24;
+       case 2: goto yy26;
        }
 yy44:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -319,11 +327,11 @@ yy44:     ++YYCURSOR;
 yy45:  yych = *++YYCURSOR;
        goto yy46;
 yy46:
-#line 116 "scanner.re"
+#line 120 "scanner.re"
 { cur = cursor;
                                  yylval.regexp = ranToRE(token());
                                  return RANGE; }
-#line 246 "re2c-output.c"
+#line 250 "re2c-output.c"
 yy47:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
@@ -344,199 +352,246 @@ yy49:   ++YYCURSOR;
 yy50:  yych = *++YYCURSOR;
        goto yy51;
 yy51:
-#line 111 "scanner.re"
+#line 115 "scanner.re"
 { cur = cursor;
                                  yylval.regexp = strToRE(token());
                                  return STRING; }
-#line 271 "re2c-output.c"
+#line 275 "re2c-output.c"
 yy52:  yych = *++YYCURSOR;
        goto yy53;
 yy53:
-#line 108 "scanner.re"
+#line 112 "scanner.re"
 { tok = cursor;
                                  RETURN(0); }
-#line 278 "re2c-output.c"
+#line 282 "re2c-output.c"
 yy54:  yych = *++YYCURSOR;
        goto yy55;
 yy55:
-#line 105 "scanner.re"
+#line 109 "scanner.re"
 { depth = 1;
                                  goto comment; }
-#line 285 "re2c-output.c"
+#line 289 "re2c-output.c"
+yy56:  ++YYCURSOR;
+       if(YYLIMIT == YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       goto yy57;
+yy57:  if(yych <= '/'){
+               if(yych == ',') goto yy60;
+               goto yy43;
+       } else {
+               if(yych <= '9') goto yy56;
+               if(yych != '}') goto yy43;
+               goto yy58;
+       }
+yy58:  yych = *++YYCURSOR;
+       goto yy59;
+yy59:
+#line 130 "scanner.re"
+{ yylval.extop.minsize = atoi((char *)tok+1);
+                                 yylval.extop.maxsize = atoi((char *)tok+1);
+                                 RETURN(CLOSESIZE); }
+#line 309 "re2c-output.c"
+yy60:  yych = *++YYCURSOR;
+       if(yych != '}') goto yy64;
+       goto yy61;
+yy61:  yych = *++YYCURSOR;
+       goto yy62;
+yy62:
+#line 138 "scanner.re"
+{ yylval.extop.minsize = atoi((char *)tok+1);
+                                 yylval.extop.maxsize = -1;
+                                 RETURN(CLOSESIZE); }
+#line 320 "re2c-output.c"
+yy63:  ++YYCURSOR;
+       if(YYLIMIT == YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       goto yy64;
+yy64:  if(yych <= '/') goto yy43;
+       if(yych <= '9') goto yy63;
+       if(yych != '}') goto yy43;
+       goto yy65;
+yy65:  yych = *++YYCURSOR;
+       goto yy66;
+yy66:
+#line 134 "scanner.re"
+{ yylval.extop.minsize = atoi((char *)tok+1);
+                                 yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
+                                 RETURN(CLOSESIZE); }
+#line 336 "re2c-output.c"
 }
-#line 140 "scanner.re"
+#line 156 "scanner.re"
 
 
 code:
 
-#line 289 "re2c-output.c"
+#line 340 "re2c-output.c"
 {
        YYCTYPE yych;
        unsigned int yyaccept;
-       goto yy56;
-yy57:  ++YYCURSOR;
-yy56:
+       goto yy67;
+yy68:  ++YYCURSOR;
+yy67:
        if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
        yych = *YYCURSOR;
        if(yych <= '&'){
                if(yych <= '\n'){
-                       if(yych <= '\t')        goto yy64;
-                       goto yy62;
+                       if(yych <= '\t')        goto yy75;
+                       goto yy73;
                } else {
-                       if(yych == '"') goto yy66;
-                       goto yy64;
+                       if(yych == '"') goto yy77;
+                       goto yy75;
                }
        } else {
                if(yych <= '{'){
-                       if(yych <= '\'')        goto yy67;
-                       if(yych <= 'z') goto yy64;
-                       goto yy60;
+                       if(yych <= '\'')        goto yy78;
+                       if(yych <= 'z') goto yy75;
+                       goto yy71;
                } else {
-                       if(yych != '}') goto yy64;
-                       goto yy58;
+                       if(yych != '}') goto yy75;
+                       goto yy69;
                }
        }
-yy58:  yych = *++YYCURSOR;
-       goto yy59;
-yy59:
-#line 144 "scanner.re"
+yy69:  yych = *++YYCURSOR;
+       goto yy70;
+yy70:
+#line 160 "scanner.re"
 { if(--depth == 0){
                                        cur = cursor;
                                        yylval.token = new Token(token(), tline);
                                        return CODE;
                                  }
                                  goto code; }
-#line 326 "re2c-output.c"
-yy60:  yych = *++YYCURSOR;
-       goto yy61;
-yy61:
-#line 150 "scanner.re"
+#line 377 "re2c-output.c"
+yy71:  yych = *++YYCURSOR;
+       goto yy72;
+yy72:
+#line 166 "scanner.re"
 { ++depth;
                                  goto code; }
-#line 333 "re2c-output.c"
-yy62:  yych = *++YYCURSOR;
-       goto yy63;
-yy63:
-#line 152 "scanner.re"
+#line 384 "re2c-output.c"
+yy73:  yych = *++YYCURSOR;
+       goto yy74;
+yy74:
+#line 168 "scanner.re"
 { if(cursor == eof) fatal("missing '}'");
                                  pos = cursor; cline++;
                                  goto code;
                                }
-#line 342 "re2c-output.c"
-yy64:  yych = *++YYCURSOR;
-       goto yy65;
-yy65:
-#line 156 "scanner.re"
+#line 393 "re2c-output.c"
+yy75:  yych = *++YYCURSOR;
+       goto yy76;
+yy76:
+#line 172 "scanner.re"
 { goto code; }
-#line 348 "re2c-output.c"
-yy66:  yyaccept = 0;
+#line 399 "re2c-output.c"
+yy77:  yyaccept = 0;
        yych = *(YYMARKER = ++YYCURSOR);
-       if(yych == '\n')        goto yy65;
-       goto yy73;
-yy67:  yyaccept = 0;
+       if(yych == '\n')        goto yy76;
+       goto yy84;
+yy78:  yyaccept = 0;
        yych = *(YYMARKER = ++YYCURSOR);
-       if(yych == '\n')        goto yy65;
-       goto yy69;
-yy68:  ++YYCURSOR;
+       if(yych == '\n')        goto yy76;
+       goto yy80;
+yy79:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
-       goto yy69;
-yy69:  if(yych <= '&'){
-               if(yych != '\n')        goto yy68;
-               goto yy70;
+       goto yy80;
+yy80:  if(yych <= '&'){
+               if(yych != '\n')        goto yy79;
+               goto yy81;
        } else {
-               if(yych <= '\'')        goto yy64;
-               if(yych == '\\')        goto yy71;
-               goto yy68;
+               if(yych <= '\'')        goto yy75;
+               if(yych == '\\')        goto yy82;
+               goto yy79;
        }
-yy70:  YYCURSOR = YYMARKER;
+yy81:  YYCURSOR = YYMARKER;
        switch(yyaccept){
-       case 0: goto yy65;
+       case 0: goto yy76;
        }
-yy71:  ++YYCURSOR;
+yy82:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
-       if(yych == '\n')        goto yy70;
-       goto yy68;
-yy72:  ++YYCURSOR;
+       if(yych == '\n')        goto yy81;
+       goto yy79;
+yy83:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
-       goto yy73;
-yy73:  if(yych <= '!'){
-               if(yych == '\n')        goto yy70;
-               goto yy72;
+       goto yy84;
+yy84:  if(yych <= '!'){
+               if(yych == '\n')        goto yy81;
+               goto yy83;
        } else {
-               if(yych <= '"') goto yy64;
-               if(yych != '\\')        goto yy72;
-               goto yy74;
+               if(yych <= '"') goto yy75;
+               if(yych != '\\')        goto yy83;
+               goto yy85;
        }
-yy74:  ++YYCURSOR;
+yy85:  ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
        yych = *YYCURSOR;
-       if(yych == '\n')        goto yy70;
-       goto yy72;
+       if(yych == '\n')        goto yy81;
+       goto yy83;
 }
-#line 157 "scanner.re"
+#line 173 "scanner.re"
 
 
 comment:
 
-#line 398 "re2c-output.c"
+#line 449 "re2c-output.c"
 {
        YYCTYPE yych;
        unsigned int yyaccept;
-       goto yy75;
-yy76:  ++YYCURSOR;
-yy75:
+       goto yy86;
+yy87:  ++YYCURSOR;
+yy86:
        if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
        yych = *YYCURSOR;
        if(yych <= ')'){
-               if(yych == '\n')        goto yy80;
-               goto yy82;
+               if(yych == '\n')        goto yy91;
+               goto yy93;
        } else {
-               if(yych <= '*') goto yy77;
-               if(yych == '/') goto yy79;
-               goto yy82;
+               if(yych <= '*') goto yy88;
+               if(yych == '/') goto yy90;
+               goto yy93;
        }
-yy77:  yych = *++YYCURSOR;
-       if(yych == '/') goto yy85;
-       goto yy78;
-yy78:
-#line 171 "scanner.re"
+yy88:  yych = *++YYCURSOR;
+       if(yych == '/') goto yy96;
+       goto yy89;
+yy89:
+#line 187 "scanner.re"
 { goto comment; }
-#line 421 "re2c-output.c"
-yy79:  yych = *++YYCURSOR;
-       if(yych == '*') goto yy83;
-       goto yy78;
-yy80:  yych = *++YYCURSOR;
-       goto yy81;
-yy81:
-#line 167 "scanner.re"
+#line 472 "re2c-output.c"
+yy90:  yych = *++YYCURSOR;
+       if(yych == '*') goto yy94;
+       goto yy89;
+yy91:  yych = *++YYCURSOR;
+       goto yy92;
+yy92:
+#line 183 "scanner.re"
 { if(cursor == eof) RETURN(0);
                                  tok = pos = cursor; cline++;
                                  goto comment;
                                }
-#line 433 "re2c-output.c"
-yy82:  yych = *++YYCURSOR;
-       goto yy78;
-yy83:  yych = *++YYCURSOR;
-       goto yy84;
-yy84:
-#line 165 "scanner.re"
+#line 484 "re2c-output.c"
+yy93:  yych = *++YYCURSOR;
+       goto yy89;
+yy94:  yych = *++YYCURSOR;
+       goto yy95;
+yy95:
+#line 181 "scanner.re"
 { ++depth;
                                  goto comment; }
-#line 442 "re2c-output.c"
-yy85:  yych = *++YYCURSOR;
-       goto yy86;
-yy86:
-#line 161 "scanner.re"
+#line 493 "re2c-output.c"
+yy96:  yych = *++YYCURSOR;
+       goto yy97;
+yy97:
+#line 177 "scanner.re"
 { if(--depth == 0)
                                        goto scan;
                                    else
                                        goto comment; }
-#line 451 "re2c-output.c"
+#line 502 "re2c-output.c"
 }
-#line 172 "scanner.re"
+#line 188 "scanner.re"
 
 }
 
index ba8fc0167d2a81671e66ca65b72d9f416756496f..6d903b6c0b2e0295cbe49631a6b0f640772c259c 100644 (file)
@@ -1,23 +1,69 @@
-#ifndef BISON_Y_TAB_H
-# define BISON_Y_TAB_H
+/* A Bison parser, made by GNU Bison 1.875.  */
 
-#ifndef YYSTYPE
-typedef union {
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     CLOSESIZE = 258,
+     CLOSE = 259,
+     ID = 260,
+     CODE = 261,
+     RANGE = 262,
+     STRING = 263
+   };
+#endif
+#define CLOSESIZE 258
+#define CLOSE 259
+#define ID 260
+#define CODE 261
+#define RANGE 262
+#define STRING 263
+
+
+
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 58 "parser.y"
+typedef union YYSTYPE {
     Symbol     *symbol;
     RegExp     *regexp;
     Token      *token;
     char       op;
-} yystype;
-# define YYSTYPE yystype
+    ExtOp      extop;
+} YYSTYPE;
+/* Line 1240 of yacc.c.  */
+#line 60 "y.tab.h"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
 #endif
-# define       CLOSE   257
-# define       ID      258
-# define       CODE    259
-# define       RANGE   260
-# define       STRING  261
-
 
 extern YYSTYPE yylval;
 
-#endif /* not BISON_Y_TAB_H */
+
+
diff --git a/examples/repeater.re b/examples/repeater.re
new file mode 100755 (executable)
index 0000000..c8e2055
--- /dev/null
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define RET(n) printf("%d\n", n); return n
+
+int scan(char *s, int l){
+char *p = s;
+char *q;
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l)
+#define YYMARKER        q
+#define YYFILL(n)
+/*!re2c
+       "a"{1}"\n"          {RET(1);}
+       "a"{2,3}"\n"    {RET(2);}
+       "a"{4,}"\n"         {RET(3);}
+       [^aq]|"\n"      {RET(0);}
+*/
+}
+
+#define do_scan(str) scan(str, strlen(str))
+
+main()
+{
+       do_scan("a\n");
+       do_scan("aa\n");
+       do_scan("aaa\n");
+       do_scan("aaaa\n");
+       do_scan("q");
+       do_scan("a");
+       do_scan("\n");
+       do_scan("0");
+}
index 0d075fb7ac3e6dc93b58b188b082c154b9714796..e33fa9027737ba31b46f3c2b4e07966ddf729588 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -60,12 +60,14 @@ static Scanner *in;
     RegExp     *regexp;
     Token      *token;
     char       op;
-}
+    ExtOp      extop;
+};
 
-%token         CLOSE   ID      CODE    RANGE   STRING
+%token         CLOSESIZE   CLOSE       ID      CODE    RANGE   STRING
 
 %type  <op>            CLOSE
 %type  <op>            close
+%type  <extop>         CLOSESIZE
 %type  <symbol>        ID
 %type  <token>         CODE
 %type  <regexp>        RANGE   STRING
@@ -134,6 +136,10 @@ factor     :       primary
                        break;
                    }
                }
+       |       primary CLOSESIZE
+               {
+                       $$ = new CloseVOp($1, $2.minsize, $2.maxsize);
+               }
        ;
 
 close  :       CLOSE
diff --git a/re.h b/re.h
index 70202a5bc88e3af5dc55b9b70f87ebc0328d8313..51fd1c7bb91f7e3a7c6bae80cf2a038bc0f4e72e 100644 (file)
--- a/re.h
+++ b/re.h
@@ -6,6 +6,12 @@
 #include "token.h"
 #include "ins.h"
 
+typedef struct extop {
+      char      op;
+      int      minsize;
+      int      maxsize;
+} ExtOp;
+
 struct CharPtn {
     uint       card;
     CharPtn    *fix;
@@ -171,6 +177,26 @@ public:
     }
 };
 
+class CloseVOp: public RegExp {
+private:
+    RegExp     *exp;
+    int                min;
+    int                max;
+public:
+    static char *type;
+public:
+    CloseVOp(RegExp *e, int lb, int ub)
+       { exp = e; min = lb; max = ub; }
+    char *typeOf()
+       { return type; }
+    void split(CharSet&);
+    void calcSize(Char*);
+    void compile(Char*, Ins*);
+    void display(ostream &o) const {
+       o << exp << "+";
+    }
+};
+
 extern void genCode(ostream&, RegExp*);
 extern RegExp *mkDiff(RegExp*, RegExp*);
 extern RegExp *strToRE(SubStr);
index e1f0a3cbf5328858eaef6a5510d6b65b7f456c7b..4b76eb4c8ca09a18e08e97359fbd293d22973708 100644 (file)
@@ -9,6 +9,10 @@
 
 extern YYSTYPE yylval;
 
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
 #define        BSIZE   8192
 
 #define        YYCTYPE         char
@@ -78,11 +82,11 @@ int Scanner::echo(ostream &out){
     tok = cursor;
 echo:
 /*!re2c
-       "/*!re2c"               { out.write((const char*)(tok), &cursor[-7] - tok);
+       "/*!re2c"               { out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
                                  tok = cursor;
                                  RETURN(1); }
        "\n"                    { if(cursor == eof) RETURN(0);
-                                 out.write((const char*)(tok), cursor - tok);
+                                 out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                  tok = pos = cursor; cline++;
                                  goto echo; }
         any                    { goto echo; }
@@ -123,6 +127,18 @@ scan:
        [*+?]                   { yylval.op = *tok;
                                  RETURN(CLOSE); }
 
+       "{" [0-9]+ "}"          { yylval.extop.minsize = atoi((char *)tok+1);
+                                 yylval.extop.maxsize = atoi((char *)tok+1);
+                                 RETURN(CLOSESIZE); }
+
+       "{" [0-9]+ "," [0-9]+ "}"       { yylval.extop.minsize = atoi((char *)tok+1);
+                                 yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
+                                 RETURN(CLOSESIZE); }
+
+       "{" [0-9]+ ",}"         { yylval.extop.minsize = atoi((char *)tok+1);
+                                 yylval.extop.maxsize = -1;
+                                 RETURN(CLOSESIZE); }
+
        letter (letter|digit)*  { cur = cursor;
                                  yylval.symbol = Symbol::find(token());
                                  return ID; }