/* A recursive-descent parser generated by greg 0.4.4 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct _GREG;
#define YYRULECOUNT 37

# include "greg.h"

# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <libgen.h>
# include <assert.h>

  typedef struct Header Header;

  struct Header {
    char   *text;
    Header *next;
  };

  FILE *input= 0;

  int   verboseFlag= 0;

  static int	 lineNumber= 0;
  static const char	*fileName= 0;
  static char	*trailer= 0;
  static Header	*headers= 0;

  void makeHeader(char *text);
  void makeTrailer(char *text);

  void yyerror(struct _GREG *, const char *message);

# define YY_INPUT(buf, result, max, D)		    \
  {						                        \
    int c= getc(input);                         \
    if ('\n' == c || '\r' == c) ++lineNumber;	\
    result= (EOF == c) ? 0 : (*(buf)= c, 1);	\
  }

# define YY_LOCAL(T)	static T
# define YY_RULE(T)	static T

#ifndef YY_ALLOC
#define YY_ALLOC(N, D) malloc(N)
#endif
#ifndef YY_CALLOC
#define YY_CALLOC(N, S, D) calloc(N, S)
#endif
#ifndef YY_REALLOC
#define YY_REALLOC(B, N, D) realloc(B, N)
#endif
#ifndef YY_FREE
#define YY_FREE free
#endif
#ifndef YY_LOCAL
#define YY_LOCAL(T)     static T
#endif
#ifndef YY_ACTION
#define YY_ACTION(T)    static T
#endif
#ifndef YY_RULE
#define YY_RULE(T)      static T
#endif
#ifndef YY_PARSE
#define YY_PARSE(T)     T
#endif
#ifndef YY_NAME
#define YY_NAME(N) yy##N
#endif
#ifndef YY_INPUT
#define YY_INPUT(buf, result, max_size, D)		\
  {							\
    int yyc= getchar();					\
    result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1);	\
    yyprintf((stderr, "<%c>", yyc));			\
  }
#endif
#ifndef YY_BEGIN
#define YY_BEGIN        ( G->begin= G->pos, 1)
#endif
#ifndef YY_END
#define YY_END          ( G->end= G->pos, 1)
#endif
#ifdef YY_DEBUG
# ifndef DEBUG_PARSE
#  define DEBUG_PARSE   1
# endif
# ifndef DEBUG_VERBOSE
#  define DEBUG_VERBOSE 2
# endif
# define yyprintf(args)	         if (G->debug & DEBUG_PARSE)         fprintf args
# define yyprintfv(args)         if (G->debug == (DEBUG_PARSE|DEBUG_VERBOSE)) fprintf args
# define yyprintfGcontext        if (G->debug & DEBUG_PARSE)         yyprintcontext(stderr,G->buf+G->pos)
# define yyprintfvGcontext       if (G->debug == (DEBUG_PARSE|DEBUG_VERBOSE)) yyprintcontext(stderr,G->buf+G->pos)
# define yyprintfvTcontext(text) if (G->debug == (DEBUG_PARSE|DEBUG_VERBOSE)) yyprintcontext(stderr,text)
#else
# define yyprintf(args)
# define yyprintfv(args)
# define yyprintfGcontext
# define yyprintfvGcontext
# define yyprintfvTcontext(text)
#endif
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#ifndef YY_XTYPE
#define YY_XTYPE void *
#endif
#ifndef YY_XVAR
#define YY_XVAR yyxvar
#endif

#ifndef YY_STACK_SIZE
#define YY_STACK_SIZE 128
#endif

#ifndef YY_BUFFER_START_SIZE
#define YY_BUFFER_START_SIZE 1024
#endif

#ifndef YY_PART
#define yydata G->data
#define yy G->ss

struct _yythunk; /* forward declaration */
typedef void (*yyaction)(struct _GREG *G, char *yytext, int yyleng, struct _yythunk *thunkpos, YY_XTYPE YY_XVAR);
typedef struct _yythunk { int begin, end;  yyaction  action; const char *name; struct _yythunk *next; } yythunk;

typedef struct _GREG {
  char *buf;
  int buflen;
  int   offset;
  int   pos;
  int   limit;
  char *text;
  int   textlen;
  int   begin;
  int   end;
  yythunk *thunks;
  int   thunkslen;
  int thunkpos;
  YYSTYPE ss;
  YYSTYPE *val;
  YYSTYPE *vals;
  int valslen;
  YY_XTYPE data;
#ifdef YY_DEBUG
  int debug;
#endif
} GREG;

YY_LOCAL(int) yyrefill(GREG *G)
{
  int yyn;
  while (G->buflen - G->pos < 512)
    {
      G->buflen *= 2;
      G->buf= (char*)YY_REALLOC(G->buf, G->buflen, G->data);
    }
  YY_INPUT((G->buf + G->pos), yyn, (G->buflen - G->pos), G->data);
  if (!yyn) return 0;
  G->limit += yyn;
  return 1;
}

YY_LOCAL(int) yymatchDot(GREG *G)
{
  if (G->pos >= G->limit && !yyrefill(G)) return 0;
  ++G->pos;
  return 1;
}

#ifdef YY_DEBUG
YY_LOCAL(void) yyprintcontext(FILE *stream, char *s)
{
  char *context = s;
  char *nl = strchr(context, 10);
  if (nl) {
    context = (char*)malloc(nl-s+1);
    strncpy(context, s, nl-s);
    context[nl-s] = '\0'; /* replace nl by 0 */
  }
  fprintf(stream, " @ \"%s\"", context);
  if (nl) free(context);
}
#endif

YY_LOCAL(int) yymatchChar(GREG *G, int c)
{
  if (G->pos >= G->limit && !yyrefill(G)) return 0;
  if ((unsigned char)G->buf[G->pos] == c)
    {
      ++G->pos;
      if (c<32) { yyprintf((stderr, "  ok   yymatchChar '0x%x'", c));}
      else      { yyprintf((stderr, "  ok   yymatchChar '%c'", c));}
      yyprintfGcontext;
      yyprintf((stderr, "\n"));
      return 1;
    }
  if (c<32) { yyprintfv((stderr, "  fail yymatchChar '0x%x'", c));}
  else      { yyprintfv((stderr, "  fail yymatchChar '%c'", c));}
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));
  return 0;
}

YY_LOCAL(int) yymatchString(GREG *G, const char *s)
{
  int yysav= G->pos;
  while (*s)
    {
      if (G->pos >= G->limit && !yyrefill(G)) return 0;
      if (G->buf[G->pos] != *s)
        {
          G->pos= yysav;
          return 0;
        }
      ++s;
      ++G->pos;
    }
  return 1;
}

YY_LOCAL(int) yymatchClass(GREG *G, const unsigned char *bits, const char *cclass)
{
  int c;
  if (G->pos >= G->limit && !yyrefill(G)) return 0;
  c= (unsigned char)G->buf[G->pos];
  if (bits[c >> 3] & (1 << (c & 7)))
    {
      ++G->pos;
      yyprintf((stderr, "  ok   yymatchClass [%s]", cclass));
      yyprintfGcontext;
      yyprintf((stderr, "\n"));
      return 1;
    }
  yyprintfv((stderr, "  fail yymatchClass [%s]", cclass));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));
  return 0;
}

YY_LOCAL(void) yyDo(GREG *G, yyaction action, int begin, int end, const char *name)
{
  while (G->thunkpos >= G->thunkslen)
    {
      G->thunkslen *= 2;
      G->thunks= (yythunk*)YY_REALLOC(G->thunks, sizeof(yythunk) * G->thunkslen, G->data);
    }
  G->thunks[G->thunkpos].begin=  begin;
  G->thunks[G->thunkpos].end=    end;
  G->thunks[G->thunkpos].action= action;
  G->thunks[G->thunkpos].name= name;
  ++G->thunkpos;
}

YY_LOCAL(int) yyText(GREG *G, int begin, int end)
{
  int yyleng= end - begin;
  if (yyleng <= 0)
    yyleng= 0;
  else
    {
      while (G->textlen < (yyleng + 1))
        {
          G->textlen *= 2;
          G->text= (char*)YY_REALLOC(G->text, G->textlen, G->data);
        }
      memcpy(G->text, G->buf + begin, yyleng);
    }
  G->text[yyleng]= '\0';
  return yyleng;
}

YY_LOCAL(void) yyDone(GREG *G)
{
  int pos;
  for (pos= 0; pos < G->thunkpos; ++pos)
    {
      yythunk *thunk= &G->thunks[pos];
      int yyleng= thunk->end ? yyText(G, thunk->begin, thunk->end) : thunk->begin;
      yyprintf((stderr, "DO [%d] %s", pos, thunk->name));
      yyprintfvTcontext(G->text);
      yyprintf((stderr, "\n"));
      thunk->action(G, G->text, yyleng, thunk, G->data);
    }
  G->thunkpos= 0;
}

YY_LOCAL(void) yyCommit(GREG *G)
{
  if ((G->limit -= G->pos))
    {
      memmove(G->buf, G->buf + G->pos, G->limit);
    }
  G->offset += G->pos;
  G->begin -= G->pos;
  G->end -= G->pos;
  G->pos= G->thunkpos= 0;
}

YY_LOCAL(int) yyAccept(GREG *G, int tp0)
{
  if (tp0)
    {
      fprintf(stderr, "accept denied at %d\n", tp0);
      return 0;
    }
  else
    {
      yyDone(G);
      yyCommit(G);
    }
  return 1;
}

YY_LOCAL(void) yyPush(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR)	{
  size_t off = (G->val - G->vals) + count;
  if (off > G->valslen) {
    while (G->valslen < off + 1)
      G->valslen *= 2;
    G->vals= (YYSTYPE*)YY_REALLOC((void *)G->vals, sizeof(YYSTYPE) * G->valslen, G->data);
    G->val= G->vals + off;
  } else {
    G->val += count;
  }
}
YY_LOCAL(void) yyPop(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR)	{ G->val -= count; }
YY_LOCAL(void) yySet(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR)	{ G->val[count]= G->ss; }

#endif /* YY_PART */

#define YYACCEPT        yyAccept(G, yythunkpos0)

YY_RULE(int) yy_end_of_line(GREG *G); /* 37 */
YY_RULE(int) yy_comment(GREG *G); /* 36 */
YY_RULE(int) yy_space(GREG *G); /* 35 */
YY_RULE(int) yy_braces(GREG *G); /* 34 */
YY_RULE(int) yy_range(GREG *G); /* 33 */
YY_RULE(int) yy_char(GREG *G); /* 32 */
YY_RULE(int) yy_errblock(GREG *G); /* 31 */
YY_RULE(int) yy_END(GREG *G); /* 30 */
YY_RULE(int) yy_BEGIN(GREG *G); /* 29 */
YY_RULE(int) yy_DOT(GREG *G); /* 28 */
YY_RULE(int) yy_class(GREG *G); /* 27 */
YY_RULE(int) yy_literal(GREG *G); /* 26 */
YY_RULE(int) yy_CLOSE(GREG *G); /* 25 */
YY_RULE(int) yy_OPEN(GREG *G); /* 24 */
YY_RULE(int) yy_COLON(GREG *G); /* 23 */
YY_RULE(int) yy_PLUS(GREG *G); /* 22 */
YY_RULE(int) yy_STAR(GREG *G); /* 21 */
YY_RULE(int) yy_QUESTION(GREG *G); /* 20 */
YY_RULE(int) yy_primary(GREG *G); /* 19 */
YY_RULE(int) yy_NOT(GREG *G); /* 18 */
YY_RULE(int) yy_suffix(GREG *G); /* 17 */
YY_RULE(int) yy_action(GREG *G); /* 16 */
YY_RULE(int) yy_AND(GREG *G); /* 15 */
YY_RULE(int) yy_prefix(GREG *G); /* 14 */
YY_RULE(int) yy_BAR(GREG *G); /* 13 */
YY_RULE(int) yy_sequence(GREG *G); /* 12 */
YY_RULE(int) yy_SEMICOLON(GREG *G); /* 11 */
YY_RULE(int) yy_expression(GREG *G); /* 10 */
YY_RULE(int) yy_EQUAL(GREG *G); /* 9 */
YY_RULE(int) yy_identifier(GREG *G); /* 8 */
YY_RULE(int) yy_RPERCENT(GREG *G); /* 7 */
YY_RULE(int) yy_end_of_file(GREG *G); /* 6 */
YY_RULE(int) yy_trailer(GREG *G); /* 5 */
YY_RULE(int) yy_definition(GREG *G); /* 4 */
YY_RULE(int) yy_declaration(GREG *G); /* 3 */
YY_RULE(int) yy__(GREG *G); /* 2 */
YY_RULE(int) yy_grammar(GREG *G); /* 1 */

YY_ACTION(void) yy_10_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_10_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {Node *node = pop(); ((struct Any *) node)->errblock = strdup(yytext); push(node); }\n"));
  Node *node = pop(); ((struct Any *) node)->errblock = strdup(yytext); push(node); ;
}
YY_ACTION(void) yy_9_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_9_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makePredicate(\"YY_END\")); }\n"));
  push(makePredicate("YY_END")); ;
}
YY_ACTION(void) yy_8_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_8_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makePredicate(\"YY_BEGIN\")); }\n"));
  push(makePredicate("YY_BEGIN")); ;
}
YY_ACTION(void) yy_7_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_7_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeAction(yytext)); }\n"));
  push(makeAction(yytext)); ;
}
YY_ACTION(void) yy_6_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_6_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeDot()); }\n"));
  push(makeDot()); ;
}
YY_ACTION(void) yy_5_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_5_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeClass(yytext)); }\n"));
  push(makeClass(yytext)); ;
}
YY_ACTION(void) yy_4_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_4_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeString(yytext)); }\n"));
  push(makeString(yytext)); ;
}
YY_ACTION(void) yy_3_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_3_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeName(findRule(yytext,0))); }\n"));
  push(makeName(findRule(yytext,0))); ;
}
YY_ACTION(void) yy_2_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_2_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {Node *name= makeName(findRule(yytext,0));  name->name.variable= pop();  push(name); }\n"));
  Node *name= makeName(findRule(yytext,0));  name->name.variable= pop();  push(name); ;
}
YY_ACTION(void) yy_1_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_primary"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeVariable(yytext)); }\n"));
  push(makeVariable(yytext)); ;
}
YY_ACTION(void) yy_3_suffix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_3_suffix"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makePlus (pop())); }\n"));
  push(makePlus (pop())); ;
}
YY_ACTION(void) yy_2_suffix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_2_suffix"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeStar (pop())); }\n"));
  push(makeStar (pop())); ;
}
YY_ACTION(void) yy_1_suffix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_suffix"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makeQuery(pop())); }\n"));
  push(makeQuery(pop())); ;
}
YY_ACTION(void) yy_3_prefix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_3_prefix"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makePeekNot(pop())); }\n"));
  push(makePeekNot(pop())); ;
}
YY_ACTION(void) yy_2_prefix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_2_prefix"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makePeekFor(pop())); }\n"));
  push(makePeekFor(pop())); ;
}
YY_ACTION(void) yy_1_prefix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_prefix"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {push(makePredicate(yytext)); }\n"));
  push(makePredicate(yytext)); ;
}
YY_ACTION(void) yy_1_sequence(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_sequence"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {Node *f= pop();  push(Sequence_append(pop(), f)); }\n"));
  Node *f= pop();  push(Sequence_append(pop(), f)); ;
}
YY_ACTION(void) yy_1_expression(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_expression"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {Node *f= pop();  push(Alternate_append(pop(), f)); }\n"));
  Node *f= pop();  push(Alternate_append(pop(), f)); ;
}
YY_ACTION(void) yy_2_definition(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
#define s G->val[-1]
  yyprintf((stderr, "do yy_2_definition"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {Node *e= pop();  Rule_setExpression(pop(), e); }\n"));
  Node *e= pop();  Rule_setExpression(pop(), e); ;
#undef s
}
YY_ACTION(void) yy_1_definition(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
#define s G->val[-1]
  yyprintf((stderr, "do yy_1_definition"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {if (push(beginRule(findRule(yytext,1)))->rule.expression)\n\
\t\t\t\t\t\t\t    fprintf(stderr, \"rule '%%s' redefined\\n\", yytext); }\n"));
  if (push(beginRule(findRule(yytext,1)))->rule.expression)
							    fprintf(stderr, "rule '%s' redefined\n", yytext); ;
#undef s
}
YY_ACTION(void) yy_1_trailer(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_trailer"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {makeTrailer(yytext); }\n"));
  makeTrailer(yytext); ;
}
YY_ACTION(void) yy_1_declaration(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_declaration"));
  yyprintfvTcontext(yytext);
  yyprintf((stderr, "\n  {makeHeader(yytext); }\n"));
  makeHeader(yytext); ;
}

YY_RULE(int) yy_end_of_line(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "end_of_line"));

  {  int yypos2= G->pos, yythunkpos2= G->thunkpos;  if (!yymatchString(G, "\r\n")) goto l3;
  goto l2;
  l3:;	  G->pos= yypos2; G->thunkpos= yythunkpos2;  if (!yymatchChar(G, '\n')) goto l4;
  goto l2;
  l4:;	  G->pos= yypos2; G->thunkpos= yythunkpos2;  if (!yymatchChar(G, '\r')) goto l1;

  }
  l2:;	  yyprintf((stderr, "  ok   end_of_line"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l1:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "end_of_line"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_comment(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "comment"));
  if (!yymatchChar(G, '#')) goto l5;

  l6:;	
  {  int yypos7= G->pos, yythunkpos7= G->thunkpos;
  {  int yypos8= G->pos, yythunkpos8= G->thunkpos;  if (!yy_end_of_line(G))  goto l8;
  goto l7;
  l8:;	  G->pos= yypos8; G->thunkpos= yythunkpos8;
  }  if (!yymatchDot(G)) goto l7;  goto l6;
  l7:;	  G->pos= yypos7; G->thunkpos= yythunkpos7;
  }  if (!yy_end_of_line(G))  goto l5;
  yyprintf((stderr, "  ok   comment"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l5:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "comment"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_space(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "space"));

  {  int yypos10= G->pos, yythunkpos10= G->thunkpos;  if (!yymatchChar(G, ' ')) goto l11;
  goto l10;
  l11:;	  G->pos= yypos10; G->thunkpos= yythunkpos10;  if (!yymatchChar(G, '\t')) goto l12;
  goto l10;
  l12:;	  G->pos= yypos10; G->thunkpos= yythunkpos10;  if (!yy_end_of_line(G))  goto l9;

  }
  l10:;	  yyprintf((stderr, "  ok   space"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l9:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "space"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_braces(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "braces"));

  {  int yypos14= G->pos, yythunkpos14= G->thunkpos;  if (!yymatchChar(G, '{')) goto l15;

  l16:;	
  {  int yypos17= G->pos, yythunkpos17= G->thunkpos;
  {  int yypos18= G->pos, yythunkpos18= G->thunkpos;  if (!yymatchChar(G, '}')) goto l18;
  goto l17;
  l18:;	  G->pos= yypos18; G->thunkpos= yythunkpos18;
  }  if (!yymatchDot(G)) goto l17;  goto l16;
  l17:;	  G->pos= yypos17; G->thunkpos= yythunkpos17;
  }  if (!yymatchChar(G, '}')) goto l15;
  goto l14;
  l15:;	  G->pos= yypos14; G->thunkpos= yythunkpos14;
  {  int yypos19= G->pos, yythunkpos19= G->thunkpos;  if (!yymatchChar(G, '}')) goto l19;
  goto l13;
  l19:;	  G->pos= yypos19; G->thunkpos= yythunkpos19;
  }  if (!yymatchDot(G)) goto l13;
  }
  l14:;	  yyprintf((stderr, "  ok   braces"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l13:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "braces"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_range(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "range"));

  {  int yypos21= G->pos, yythunkpos21= G->thunkpos;  if (!yy_char(G))  goto l22;
  if (!yymatchChar(G, '-')) goto l22;
  if (!yy_char(G))  goto l22;
  goto l21;
  l22:;	  G->pos= yypos21; G->thunkpos= yythunkpos21;  if (!yy_char(G))  goto l20;

  }
  l21:;	  yyprintf((stderr, "  ok   range"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l20:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "range"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_char(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "char"));

  {  int yypos24= G->pos, yythunkpos24= G->thunkpos;  if (!yymatchChar(G, '\\')) goto l25;
  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\204\000\000\000\000\000\000\070\146\100\124\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "abefnrtv'\"\\[\\]\\\\")) goto l25;
  goto l24;
  l25:;	  G->pos= yypos24; G->thunkpos= yythunkpos24;  if (!yymatchChar(G, '\\')) goto l26;
  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-3")) goto l26;
  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l26;
  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l26;
  goto l24;
  l26:;	  G->pos= yypos24; G->thunkpos= yythunkpos24;  if (!yymatchChar(G, '\\')) goto l27;
  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l27;

  {  int yypos28= G->pos, yythunkpos28= G->thunkpos;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l28;
  goto l29;
  l28:;	  G->pos= yypos28; G->thunkpos= yythunkpos28;
  }
  l29:;	  goto l24;
  l27:;	  G->pos= yypos24; G->thunkpos= yythunkpos24;
  {  int yypos30= G->pos, yythunkpos30= G->thunkpos;  if (!yymatchChar(G, '\\')) goto l30;
  goto l23;
  l30:;	  G->pos= yypos30; G->thunkpos= yythunkpos30;
  }  if (!yymatchDot(G)) goto l23;
  }
  l24:;	  yyprintf((stderr, "  ok   char"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l23:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "char"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_errblock(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "errblock"));
  if (!yymatchString(G, "~{")) goto l31;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l31;
  l32:;	
  {  int yypos33= G->pos, yythunkpos33= G->thunkpos;  if (!yy_braces(G))  goto l33;
  goto l32;
  l33:;	  G->pos= yypos33; G->thunkpos= yythunkpos33;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l31;  if (!yymatchChar(G, '}')) goto l31;
  if (!yy__(G))  goto l31;
  yyprintf((stderr, "  ok   errblock"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l31:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "errblock"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_END(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "END"));
  if (!yymatchChar(G, '>')) goto l34;
  if (!yy__(G))  goto l34;
  yyprintf((stderr, "  ok   END"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l34:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "END"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_BEGIN(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "BEGIN"));
  if (!yymatchChar(G, '<')) goto l35;
  if (!yy__(G))  goto l35;
  yyprintf((stderr, "  ok   BEGIN"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l35:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "BEGIN"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_DOT(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "DOT"));
  if (!yymatchChar(G, '.')) goto l36;
  if (!yy__(G))  goto l36;
  yyprintf((stderr, "  ok   DOT"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l36:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "DOT"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_class(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "class"));
  if (!yymatchChar(G, '[')) goto l37;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l37;
  l38:;	
  {  int yypos39= G->pos, yythunkpos39= G->thunkpos;
  {  int yypos40= G->pos, yythunkpos40= G->thunkpos;  if (!yymatchChar(G, ']')) goto l40;
  goto l39;
  l40:;	  G->pos= yypos40; G->thunkpos= yythunkpos40;
  }  if (!yy_range(G))  goto l39;
  goto l38;
  l39:;	  G->pos= yypos39; G->thunkpos= yythunkpos39;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l37;  if (!yymatchChar(G, ']')) goto l37;
  if (!yy__(G))  goto l37;
  yyprintf((stderr, "  ok   class"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l37:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "class"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_literal(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "literal"));

  {  int yypos42= G->pos, yythunkpos42= G->thunkpos;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l43;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l43;
  l44:;	
  {  int yypos45= G->pos, yythunkpos45= G->thunkpos;
  {  int yypos46= G->pos, yythunkpos46= G->thunkpos;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l46;
  goto l45;
  l46:;	  G->pos= yypos46; G->thunkpos= yythunkpos46;
  }  if (!yy_char(G))  goto l45;
  goto l44;
  l45:;	  G->pos= yypos45; G->thunkpos= yythunkpos45;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l43;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l43;
  if (!yy__(G))  goto l43;
  goto l42;
  l43:;	  G->pos= yypos42; G->thunkpos= yythunkpos42;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l41;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l41;
  l47:;	
  {  int yypos48= G->pos, yythunkpos48= G->thunkpos;
  {  int yypos49= G->pos, yythunkpos49= G->thunkpos;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l49;
  goto l48;
  l49:;	  G->pos= yypos49; G->thunkpos= yythunkpos49;
  }  if (!yy_char(G))  goto l48;
  goto l47;
  l48:;	  G->pos= yypos48; G->thunkpos= yythunkpos48;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l41;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l41;
  if (!yy__(G))  goto l41;

  }
  l42:;	  yyprintf((stderr, "  ok   literal"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l41:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "literal"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_CLOSE(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "CLOSE"));
  if (!yymatchChar(G, ')')) goto l50;
  if (!yy__(G))  goto l50;
  yyprintf((stderr, "  ok   CLOSE"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l50:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "CLOSE"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_OPEN(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "OPEN"));
  if (!yymatchChar(G, '(')) goto l51;
  if (!yy__(G))  goto l51;
  yyprintf((stderr, "  ok   OPEN"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l51:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "OPEN"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_COLON(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "COLON"));
  if (!yymatchChar(G, ':')) goto l52;
  if (!yy__(G))  goto l52;
  yyprintf((stderr, "  ok   COLON"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l52:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "COLON"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_PLUS(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "PLUS"));
  if (!yymatchChar(G, '+')) goto l53;
  if (!yy__(G))  goto l53;
  yyprintf((stderr, "  ok   PLUS"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l53:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "PLUS"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_STAR(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "STAR"));
  if (!yymatchChar(G, '*')) goto l54;
  if (!yy__(G))  goto l54;
  yyprintf((stderr, "  ok   STAR"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l54:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "STAR"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_QUESTION(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "QUESTION"));
  if (!yymatchChar(G, '?')) goto l55;
  if (!yy__(G))  goto l55;
  yyprintf((stderr, "  ok   QUESTION"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l55:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "QUESTION"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_primary(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "primary"));

  {  int yypos57= G->pos, yythunkpos57= G->thunkpos;  if (!yy_identifier(G))  goto l58;
  yyDo(G, yy_1_primary, G->begin, G->end, "yy_1_primary");
  if (!yy_COLON(G))  goto l58;
  if (!yy_identifier(G))  goto l58;

  {  int yypos59= G->pos, yythunkpos59= G->thunkpos;  if (!yy_EQUAL(G))  goto l59;
  goto l58;
  l59:;	  G->pos= yypos59; G->thunkpos= yythunkpos59;
  }  yyDo(G, yy_2_primary, G->begin, G->end, "yy_2_primary");
  goto l57;
  l58:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_identifier(G))  goto l60;

  {  int yypos61= G->pos, yythunkpos61= G->thunkpos;  if (!yy_EQUAL(G))  goto l61;
  goto l60;
  l61:;	  G->pos= yypos61; G->thunkpos= yythunkpos61;
  }  yyDo(G, yy_3_primary, G->begin, G->end, "yy_3_primary");
  goto l57;
  l60:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_OPEN(G))  goto l62;
  if (!yy_expression(G))  goto l62;
  if (!yy_CLOSE(G))  goto l62;
  goto l57;
  l62:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_literal(G))  goto l63;
  yyDo(G, yy_4_primary, G->begin, G->end, "yy_4_primary");
  goto l57;
  l63:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_class(G))  goto l64;
  yyDo(G, yy_5_primary, G->begin, G->end, "yy_5_primary");
  goto l57;
  l64:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_DOT(G))  goto l65;
  yyDo(G, yy_6_primary, G->begin, G->end, "yy_6_primary");
  goto l57;
  l65:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_action(G))  goto l66;
  yyDo(G, yy_7_primary, G->begin, G->end, "yy_7_primary");
  goto l57;
  l66:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_BEGIN(G))  goto l67;
  yyDo(G, yy_8_primary, G->begin, G->end, "yy_8_primary");
  goto l57;
  l67:;	  G->pos= yypos57; G->thunkpos= yythunkpos57;  if (!yy_END(G))  goto l56;
  yyDo(G, yy_9_primary, G->begin, G->end, "yy_9_primary");

  }
  l57:;	
  {  int yypos68= G->pos, yythunkpos68= G->thunkpos;  if (!yy_errblock(G))  goto l68;
  yyDo(G, yy_10_primary, G->begin, G->end, "yy_10_primary");
  goto l69;
  l68:;	  G->pos= yypos68; G->thunkpos= yythunkpos68;
  }
  l69:;	  yyprintf((stderr, "  ok   primary"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l56:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "primary"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_NOT(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "NOT"));
  if (!yymatchChar(G, '!')) goto l70;
  if (!yy__(G))  goto l70;
  yyprintf((stderr, "  ok   NOT"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l70:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "NOT"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_suffix(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "suffix"));
  if (!yy_primary(G))  goto l71;

  {  int yypos72= G->pos, yythunkpos72= G->thunkpos;
  {  int yypos74= G->pos, yythunkpos74= G->thunkpos;  if (!yy_QUESTION(G))  goto l75;
  yyDo(G, yy_1_suffix, G->begin, G->end, "yy_1_suffix");
  goto l74;
  l75:;	  G->pos= yypos74; G->thunkpos= yythunkpos74;  if (!yy_STAR(G))  goto l76;
  yyDo(G, yy_2_suffix, G->begin, G->end, "yy_2_suffix");
  goto l74;
  l76:;	  G->pos= yypos74; G->thunkpos= yythunkpos74;  if (!yy_PLUS(G))  goto l72;
  yyDo(G, yy_3_suffix, G->begin, G->end, "yy_3_suffix");

  }
  l74:;	  goto l73;
  l72:;	  G->pos= yypos72; G->thunkpos= yythunkpos72;
  }
  l73:;	  yyprintf((stderr, "  ok   suffix"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l71:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "suffix"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_action(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "action"));
  if (!yymatchChar(G, '{')) goto l77;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l77;
  l78:;	
  {  int yypos79= G->pos, yythunkpos79= G->thunkpos;  if (!yy_braces(G))  goto l79;
  goto l78;
  l79:;	  G->pos= yypos79; G->thunkpos= yythunkpos79;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l77;  if (!yymatchChar(G, '}')) goto l77;
  if (!yy__(G))  goto l77;
  yyprintf((stderr, "  ok   action"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l77:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "action"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_AND(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "AND"));
  if (!yymatchChar(G, '&')) goto l80;
  if (!yy__(G))  goto l80;
  yyprintf((stderr, "  ok   AND"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l80:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "AND"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_prefix(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "prefix"));

  {  int yypos82= G->pos, yythunkpos82= G->thunkpos;  if (!yy_AND(G))  goto l83;
  if (!yy_action(G))  goto l83;
  yyDo(G, yy_1_prefix, G->begin, G->end, "yy_1_prefix");
  goto l82;
  l83:;	  G->pos= yypos82; G->thunkpos= yythunkpos82;  if (!yy_AND(G))  goto l84;
  if (!yy_suffix(G))  goto l84;
  yyDo(G, yy_2_prefix, G->begin, G->end, "yy_2_prefix");
  goto l82;
  l84:;	  G->pos= yypos82; G->thunkpos= yythunkpos82;  if (!yy_NOT(G))  goto l85;
  if (!yy_suffix(G))  goto l85;
  yyDo(G, yy_3_prefix, G->begin, G->end, "yy_3_prefix");
  goto l82;
  l85:;	  G->pos= yypos82; G->thunkpos= yythunkpos82;  if (!yy_suffix(G))  goto l81;

  }
  l82:;	  yyprintf((stderr, "  ok   prefix"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l81:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "prefix"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_BAR(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "BAR"));
  if (!yymatchChar(G, '|')) goto l86;
  if (!yy__(G))  goto l86;
  yyprintf((stderr, "  ok   BAR"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l86:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "BAR"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_sequence(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "sequence"));
  if (!yy_prefix(G))  goto l87;

  l88:;	
  {  int yypos89= G->pos, yythunkpos89= G->thunkpos;  if (!yy_prefix(G))  goto l89;
  yyDo(G, yy_1_sequence, G->begin, G->end, "yy_1_sequence");
  goto l88;
  l89:;	  G->pos= yypos89; G->thunkpos= yythunkpos89;
  }  yyprintf((stderr, "  ok   sequence"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l87:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "sequence"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_SEMICOLON(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "SEMICOLON"));
  if (!yymatchChar(G, ';')) goto l90;
  if (!yy__(G))  goto l90;
  yyprintf((stderr, "  ok   SEMICOLON"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l90:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "SEMICOLON"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_expression(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "expression"));
  if (!yy_sequence(G))  goto l91;

  l92:;	
  {  int yypos93= G->pos, yythunkpos93= G->thunkpos;  if (!yy_BAR(G))  goto l93;
  if (!yy_sequence(G))  goto l93;
  yyDo(G, yy_1_expression, G->begin, G->end, "yy_1_expression");
  goto l92;
  l93:;	  G->pos= yypos93; G->thunkpos= yythunkpos93;
  }  yyprintf((stderr, "  ok   expression"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l91:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "expression"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_EQUAL(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "EQUAL"));
  if (!yymatchChar(G, '=')) goto l94;
  if (!yy__(G))  goto l94;
  yyprintf((stderr, "  ok   EQUAL"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l94:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "EQUAL"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_identifier(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "identifier"));
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l95;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\040\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "-a-zA-Z_")) goto l95;

  l96:;	
  {  int yypos97= G->pos, yythunkpos97= G->thunkpos;  if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "-a-zA-Z_0-9")) goto l97;
  goto l96;
  l97:;	  G->pos= yypos97; G->thunkpos= yythunkpos97;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l95;  if (!yy__(G))  goto l95;
  yyprintf((stderr, "  ok   identifier"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l95:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "identifier"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_RPERCENT(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "RPERCENT"));
  if (!yymatchString(G, "%}")) goto l98;
  if (!yy__(G))  goto l98;
  yyprintf((stderr, "  ok   RPERCENT"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l98:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "RPERCENT"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_end_of_file(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "end_of_file"));

  {  int yypos100= G->pos, yythunkpos100= G->thunkpos;  if (!yymatchDot(G)) goto l100;  goto l99;
  l100:;	  G->pos= yypos100; G->thunkpos= yythunkpos100;
  }  yyprintf((stderr, "  ok   end_of_file"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l99:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "end_of_file"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_trailer(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "trailer"));
  if (!yymatchString(G, "%%")) goto l101;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l101;
  l102:;	
  {  int yypos103= G->pos, yythunkpos103= G->thunkpos;  if (!yymatchDot(G)) goto l103;  goto l102;
  l103:;	  G->pos= yypos103; G->thunkpos= yythunkpos103;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l101;  yyDo(G, yy_1_trailer, G->begin, G->end, "yy_1_trailer");
  yyprintf((stderr, "  ok   trailer"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l101:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "trailer"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_definition(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyDo(G, yyPush, 1, 0, "yyPush");
  yyprintfv((stderr, "%s\n", "definition"));
  if (!yy_identifier(G))  goto l104;
  yyDo(G, yySet, -1, 0, "yySet");
  yyDo(G, yy_1_definition, G->begin, G->end, "yy_1_definition");
  if (!yy_EQUAL(G))  goto l104;
  if (!yy_expression(G))  goto l104;
  yyDo(G, yy_2_definition, G->begin, G->end, "yy_2_definition");

  {  int yypos105= G->pos, yythunkpos105= G->thunkpos;  if (!yy_SEMICOLON(G))  goto l105;
  goto l106;
  l105:;	  G->pos= yypos105; G->thunkpos= yythunkpos105;
  }
  l106:;	  yyprintf((stderr, "  ok   definition"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));
  yyDo(G, yyPop, 1, 0, "yyPop");
  return 1;
  l104:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "definition"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy_declaration(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "declaration"));
  if (!yymatchString(G, "%{")) goto l107;
  yyText(G, G->begin, G->end);  if (!(YY_BEGIN)) goto l107;
  l108:;	
  {  int yypos109= G->pos, yythunkpos109= G->thunkpos;
  {  int yypos110= G->pos, yythunkpos110= G->thunkpos;  if (!yymatchString(G, "%}")) goto l110;
  goto l109;
  l110:;	  G->pos= yypos110; G->thunkpos= yythunkpos110;
  }  if (!yymatchDot(G)) goto l109;  goto l108;
  l109:;	  G->pos= yypos109; G->thunkpos= yythunkpos109;
  }  yyText(G, G->begin, G->end);  if (!(YY_END)) goto l107;  if (!yy_RPERCENT(G))  goto l107;
  yyDo(G, yy_1_declaration, G->begin, G->end, "yy_1_declaration");
  yyprintf((stderr, "  ok   declaration"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l107:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "declaration"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}
YY_RULE(int) yy__(GREG *G)
{  yyprintfv((stderr, "%s\n", "_"));

  l112:;	
  {  int yypos113= G->pos, yythunkpos113= G->thunkpos;
  {  int yypos114= G->pos, yythunkpos114= G->thunkpos;  if (!yy_space(G))  goto l115;
  goto l114;
  l115:;	  G->pos= yypos114; G->thunkpos= yythunkpos114;  if (!yy_comment(G))  goto l113;

  }
  l114:;	  goto l112;
  l113:;	  G->pos= yypos113; G->thunkpos= yythunkpos113;
  }  yyprintf((stderr, "  ok   _"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
}
YY_RULE(int) yy_grammar(GREG *G)
{  int yypos0= G->pos, yythunkpos0= G->thunkpos;  yyprintfv((stderr, "%s\n", "grammar"));
  if (!yy__(G))  goto l116;

  {  int yypos119= G->pos, yythunkpos119= G->thunkpos;  if (!yy_declaration(G))  goto l120;
  goto l119;
  l120:;	  G->pos= yypos119; G->thunkpos= yythunkpos119;  if (!yy_definition(G))  goto l116;

  }
  l119:;	
  l117:;	
  {  int yypos118= G->pos, yythunkpos118= G->thunkpos;
  {  int yypos121= G->pos, yythunkpos121= G->thunkpos;  if (!yy_declaration(G))  goto l122;
  goto l121;
  l122:;	  G->pos= yypos121; G->thunkpos= yythunkpos121;  if (!yy_definition(G))  goto l118;

  }
  l121:;	  goto l117;
  l118:;	  G->pos= yypos118; G->thunkpos= yythunkpos118;
  }
  {  int yypos123= G->pos, yythunkpos123= G->thunkpos;  if (!yy_trailer(G))  goto l123;
  goto l124;
  l123:;	  G->pos= yypos123; G->thunkpos= yythunkpos123;
  }
  l124:;	  if (!yy_end_of_file(G))  goto l116;
  yyprintf((stderr, "  ok   grammar"));
  yyprintfGcontext;
  yyprintf((stderr, "\n"));

  return 1;
  l116:;	  G->pos= yypos0; G->thunkpos= yythunkpos0;  yyprintfv((stderr, "  fail %s", "grammar"));
  yyprintfvGcontext;
  yyprintfv((stderr, "\n"));

  return 0;
}

#ifndef YY_PART

typedef int (*yyrule)(GREG *G);

YY_PARSE(int) YY_NAME(parse_from)(GREG *G, yyrule yystart)
{
  int yyok;
  if (!G->buflen)
    {
      G->buflen= YY_BUFFER_START_SIZE;
      G->buf= (char*)YY_ALLOC(G->buflen, G->data);
      G->textlen= YY_BUFFER_START_SIZE;
      G->text= (char*)YY_ALLOC(G->textlen, G->data);
      G->thunkslen= YY_STACK_SIZE;
      G->thunks= (yythunk*)YY_ALLOC(sizeof(yythunk) * G->thunkslen, G->data);
      G->valslen= YY_STACK_SIZE;
      G->vals= (YYSTYPE*)YY_ALLOC(sizeof(YYSTYPE) * G->valslen, G->data);
      G->begin= G->end= G->pos= G->limit= G->thunkpos= 0;
    }
  G->pos = 0;
  G->begin= G->end= G->pos;
  G->thunkpos= 0;
  G->val= G->vals;
  yyok= yystart(G);
  if (yyok) yyDone(G);
  yyCommit(G);
  return yyok;
  (void)yyrefill;
  (void)yymatchDot;
  (void)yymatchChar;
  (void)yymatchString;
  (void)yymatchClass;
  (void)yyDo;
  (void)yyText;
  (void)yyDone;
  (void)yyCommit;
  (void)yyAccept;
  (void)yyPush;
  (void)yyPop;
  (void)yySet;
}

YY_PARSE(int) YY_NAME(parse)(GREG *G)
{
  return YY_NAME(parse_from)(G, yy_grammar);
}

YY_PARSE(void) YY_NAME(init)(GREG *G)
{
    memset(G, 0, sizeof(GREG));
}
YY_PARSE(void) YY_NAME(deinit)(GREG *G)
{
    if (G->buf) YY_FREE(G->buf);
    if (G->text) YY_FREE(G->text);
    if (G->thunks) YY_FREE(G->thunks);
    if (G->vals) YY_FREE((void*)G->vals);
}
YY_PARSE(GREG *) YY_NAME(parse_new)(YY_XTYPE data)
{
  GREG *G = (GREG *)YY_CALLOC(1, sizeof(GREG), G->data);
  G->data = data;
  return G;
}

YY_PARSE(void) YY_NAME(parse_free)(GREG *G)
{
  YY_NAME(deinit)(G);
  YY_FREE(G);
}

#endif


void yyerror(struct _GREG *G, const char *message)
{
  fprintf(stderr, "%s:%d: %s", fileName, lineNumber, message);
  if (G->text[0]) fprintf(stderr, " near token '%s'", G->text);
  if (G->pos < G->limit || !feof(input))
    {
      G->buf[G->limit]= '\0';
      fprintf(stderr, " before text \"");
      while (G->pos < G->limit)
	{
	  if ('\n' == G->buf[G->pos] || '\r' == G->buf[G->pos]) break;
	  fputc(G->buf[G->pos++], stderr);
	}
      if (G->pos == G->limit)
	{
	  int c;
	  while (EOF != (c= fgetc(input)) && '\n' != c && '\r' != c)
	    fputc(c, stderr);
	}
      fputc('\"', stderr);
    }
  fprintf(stderr, "\n");
  exit(1);
}

void makeHeader(char *text)
{
  Header *header= (Header *)malloc(sizeof(Header));
  header->text= strdup(text);
  header->next= headers;
  headers= header;
}

void makeTrailer(char *text)
{
  trailer= strdup(text);
}

static void version(char *name)
{
  printf("%s version %d.%d.%d\n", name, GREG_MAJOR, GREG_MINOR, GREG_LEVEL);
}

static void usage(char *name)
{
  version(name);
  fprintf(stderr, "usage: %s [<option>...] [<file>...]\n", name);
  fprintf(stderr, "where <option> can be\n");
  fprintf(stderr, "  -h          print this help information\n");
  fprintf(stderr, "  -o <ofile>  write output to <ofile>\n");
  fprintf(stderr, "  -v          be verbose\n");
  fprintf(stderr, "  -V          print version number and exit\n");
  fprintf(stderr, "if no <file> is given, input is read from stdin\n");
  fprintf(stderr, "if no <ofile> is given, output is written to stdout\n");
  exit(1);
}

int main(int argc, char **argv)
{
  GREG *G;
  Node *n;
  int   c;

  output= stdout;
  input= stdin;
  lineNumber= 1;
  fileName= "<stdin>";

  while (-1 != (c= getopt(argc, argv, "Vho:v")))
    {
      switch (c)
	{
	case 'V':
	  version(basename(argv[0]));
	  exit(0);

	case 'h':
	  usage(basename(argv[0]));
	  break;

	case 'o':
	  if (!(output= fopen(optarg, "w")))
	    {
	      perror(optarg);
	      exit(1);
	    }
	  break;

	case 'v':
	  verboseFlag++;
	  break;

	default:
	  fprintf(stderr, "for usage try: %s -h\n", argv[0]);
	  exit(1);
	}
    }
  argc -= optind;
  argv += optind;

  G = yyparse_new(NULL);
#ifdef YY_DEBUG
  if (verboseFlag > 0) {
    G->debug = DEBUG_PARSE;
    if (verboseFlag > 1)
      G->debug = DEBUG_PARSE + DEBUG_VERBOSE;
  }
#endif
  if (argc)
    {
      for (;  argc;  --argc, ++argv)
	{
	  if (!strcmp(*argv, "-"))
	    {
	      input= stdin;
	      fileName= "<stdin>";
	    }
	  else
	    {
	      if (!(input= fopen(*argv, "r")))
		{
		  perror(*argv);
		  exit(1);
		}
	      fileName= *argv;
	    }
	  lineNumber= 1;
	  if (!yyparse(G))
	    yyerror(G, "syntax error");
	  if (input != stdin)
	    fclose(input);
	}
    }
  else
    if (!yyparse(G))
      yyerror(G, "syntax error");
  yyparse_free(G);

  if (verboseFlag)
    for (n= rules;  n;  n= n->any.next)
      Rule_print(n);

  Rule_compile_c_header();

  for (; headers;  headers= headers->next)
    fprintf(output, "%s\n", headers->text);

  if (rules)
    Rule_compile_c(rules);

  if (trailer)
    fprintf(output, "%s\n", trailer);

  return 0;
}

