/* A recursive-descent parser generated by peg 0.1.15 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define YYRULECOUNT 38

# include "tree.h"
# include "version.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 char	*fileName= 0;
  static char	*trailer= 0;
  static Header	*headers= 0;

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

  void yyerror(char *message);

# define YY_INPUT(buf, result, max)		\
  {						\
    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_MALLOC
#define YY_MALLOC(C, N)		malloc(N)
#endif
#ifndef YY_REALLOC
#define YY_REALLOC(C, P, N)	realloc(P, N)
#endif
#ifndef YY_FREE
#define YY_FREE(C, P)		free(P)
#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 YYPARSE
#define YYPARSE		yyparse
#endif
#ifndef YYPARSEFROM
#define YYPARSEFROM	yyparsefrom
#endif
#ifndef YYRELEASE
#define YYRELEASE	yyrelease
#endif
#ifndef YY_BEGIN
#define YY_BEGIN	( yy->__begin= yy->__pos, 1)
#endif
#ifndef YY_END
#define YY_END		( yy->__end= yy->__pos, 1)
#endif
#ifdef YY_DEBUG
# define yyprintf(args)	fprintf args
#else
# define yyprintf(args)
#endif
#ifndef YYSTYPE
#define YYSTYPE	int
#endif
#ifndef YY_STACK_SIZE
#define YY_STACK_SIZE 128
#endif

#ifndef YY_BUFFER_SIZE
#define YY_BUFFER_SIZE 1024
#endif

#ifndef YY_PART

typedef struct _yycontext yycontext;
typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng);
typedef struct _yythunk { int begin, end;  yyaction  action;  struct _yythunk *next; } yythunk;

struct _yycontext {
  char     *__buf;
  int       __buflen;
  int       __pos;
  int       __limit;
  char     *__text;
  int       __textlen;
  int       __begin;
  int       __end;
  int       __textmax;
  yythunk  *__thunks;
  int       __thunkslen;
  int       __thunkpos;
  YYSTYPE   __;
  YYSTYPE  *__val;
  YYSTYPE  *__vals;
  int       __valslen;
#ifdef YY_CTX_MEMBERS
  YY_CTX_MEMBERS
#endif
};

#ifdef YY_CTX_LOCAL
#define YY_CTX_PARAM_	yycontext *yyctx,
#define YY_CTX_PARAM	yycontext *yyctx
#define YY_CTX_ARG_	yyctx,
#define YY_CTX_ARG	yyctx
#ifndef YY_INPUT
#define YY_INPUT(yy, buf, result, max_size)		\
  {							\
    int yyc= getchar();					\
    result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1);	\
    yyprintf((stderr, "<%c>", yyc));			\
  }
#endif
#else
#define YY_CTX_PARAM_
#define YY_CTX_PARAM
#define YY_CTX_ARG_
#define YY_CTX_ARG
yycontext _yyctx= { 0, 0 };
yycontext *yyctx= &_yyctx;
#ifndef YY_INPUT
#define YY_INPUT(buf, result, max_size)			\
  {							\
    int yyc= getchar();					\
    result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1);	\
    yyprintf((stderr, "<%c>", yyc));			\
  }
#endif
#endif

YY_LOCAL(int) yyrefill(yycontext *yy)
{
  int yyn;
  while (yy->__buflen - yy->__pos < 512)
    {
      yy->__buflen *= 2;
      yy->__buf= (char *)YY_REALLOC(yy, yy->__buf, yy->__buflen);
    }
#ifdef YY_CTX_LOCAL
  YY_INPUT(yy, (yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos));
#else
  YY_INPUT((yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos));
#endif
  if (!yyn) return 0;
  yy->__limit += yyn;
  return 1;
}

YY_LOCAL(int) yymatchDot(yycontext *yy)
{
  if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
  ++yy->__pos;
  return 1;
}

YY_LOCAL(int) yymatchChar(yycontext *yy, int c)
{
  if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
  if ((unsigned char)yy->__buf[yy->__pos] == c)
    {
      ++yy->__pos;
      yyprintf((stderr, "  ok   yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos));
      return 1;
    }
  yyprintf((stderr, "  fail yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos));
  return 0;
}

YY_LOCAL(int) yymatchString(yycontext *yy, const char *s)
{
  int yysav= yy->__pos;
  while (*s)
    {
      if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
      if (yy->__buf[yy->__pos] != *s)
        {
          yy->__pos= yysav;
          return 0;
        }
      ++s;
      ++yy->__pos;
    }
  return 1;
}

YY_LOCAL(int) yymatchClass(yycontext *yy, unsigned char *bits)
{
  int c;
  if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
  c= (unsigned char)yy->__buf[yy->__pos];
  if (bits[c >> 3] & (1 << (c & 7)))
    {
      ++yy->__pos;
      yyprintf((stderr, "  ok   yymatchClass @ %s\n", yy->__buf+yy->__pos));
      return 1;
    }
  yyprintf((stderr, "  fail yymatchClass @ %s\n", yy->__buf+yy->__pos));
  return 0;
}

YY_LOCAL(void) yyDo(yycontext *yy, yyaction action, int begin, int end)
{
  while (yy->__thunkpos >= yy->__thunkslen)
    {
      yy->__thunkslen *= 2;
      yy->__thunks= (yythunk *)YY_REALLOC(yy, yy->__thunks, sizeof(yythunk) * yy->__thunkslen);
    }
  yy->__thunks[yy->__thunkpos].begin=  begin;
  yy->__thunks[yy->__thunkpos].end=    end;
  yy->__thunks[yy->__thunkpos].action= action;
  ++yy->__thunkpos;
}

YY_LOCAL(int) yyText(yycontext *yy, int begin, int end)
{
  int yyleng= end - begin;
  if (yyleng <= 0)
    yyleng= 0;
  else
    {
      while (yy->__textlen < (yyleng + 1))
	{
	  yy->__textlen *= 2;
	  yy->__text= (char *)YY_REALLOC(yy, yy->__text, yy->__textlen);
	}
      memcpy(yy->__text, yy->__buf + begin, yyleng);
    }
  yy->__text[yyleng]= '\0';
  return yyleng;
}

YY_LOCAL(void) yyDone(yycontext *yy)
{
  int pos;
  for (pos= 0;  pos < yy->__thunkpos;  ++pos)
    {
      yythunk *thunk= &yy->__thunks[pos];
      int yyleng= thunk->end ? yyText(yy, thunk->begin, thunk->end) : thunk->begin;
      yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yy->__text));
      thunk->action(yy, yy->__text, yyleng);
    }
  yy->__thunkpos= 0;
}

YY_LOCAL(void) yyCommit(yycontext *yy)
{
  if ((yy->__limit -= yy->__pos))
    {
      memmove(yy->__buf, yy->__buf + yy->__pos, yy->__limit);
    }
  yy->__begin -= yy->__pos;
  yy->__end -= yy->__pos;
  yy->__pos= yy->__thunkpos= 0;
}

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

YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count)
{
  yy->__val += count;
  while (yy->__valslen <= yy->__val - yy->__vals)
    {
      long offset= yy->__val - yy->__vals;
      yy->__valslen *= 2;
      yy->__vals= (YYSTYPE *)YY_REALLOC(yy, yy->__vals, sizeof(YYSTYPE) * yy->__valslen);
      yy->__val= yy->__vals + offset;
    }
}
YY_LOCAL(void) yyPop(yycontext *yy, char *text, int count)   { yy->__val -= count; }
YY_LOCAL(void) yySet(yycontext *yy, char *text, int count)   { yy->__val[count]= yy->__; }

#endif /* YY_PART */

#define	YYACCEPT	yyAccept(yy, yythunkpos0)

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

YY_ACTION(void) yy_9_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_9_primary\n"));
  {
   push(makePredicate("YY_END")); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_8_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_8_primary\n"));
  {
   push(makePredicate("YY_BEGIN")); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_7_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_7_primary\n"));
  {
   push(makeAction(yytext)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_6_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_6_primary\n"));
  {
   push(makeDot()); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_5_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_5_primary\n"));
  {
   push(makeClass(yytext)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_4_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_4_primary\n"));
  {
   push(makeString(yytext)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_3_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_3_primary\n"));
  {
   push(makeName(findRule(yytext))); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_2_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_2_primary\n"));
  {
   Node *name= makeName(findRule(yytext));  name->name.variable= pop();  push(name); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_primary(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_primary\n"));
  {
   push(makeVariable(yytext)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_3_suffix(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_3_suffix\n"));
  {
   push(makePlus (pop())); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_2_suffix(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_2_suffix\n"));
  {
   push(makeStar (pop())); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_suffix(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_suffix\n"));
  {
   push(makeQuery(pop())); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_3_prefix(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_3_prefix\n"));
  {
   push(makePeekNot(pop())); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_2_prefix(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_2_prefix\n"));
  {
   push(makePeekFor(pop())); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_prefix(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_prefix\n"));
  {
   push(makePredicate(yytext)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_error(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_error\n"));
  {
   push(makeError(pop(), yytext)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_sequence(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_sequence\n"));
  {
   Node *f= pop();  push(Sequence_append(pop(), f)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_expression(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_expression\n"));
  {
   Node *f= pop();  push(Alternate_append(pop(), f)); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_2_definition(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_2_definition\n"));
  {
   Node *e= pop();  Rule_setExpression(pop(), e); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_definition(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_definition\n"));
  {
   if (push(beginRule(findRule(yytext)))->rule.expression)
							    fprintf(stderr, "rule '%s' redefined\n", yytext); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_trailer(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_trailer\n"));
  {
   makeTrailer(yytext); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}
YY_ACTION(void) yy_1_declaration(yycontext *yy, char *yytext, int yyleng)
{
#define __ yy->__
#define yypos yy->__pos
#define yythunkpos yy->__thunkpos
  yyprintf((stderr, "do yy_1_declaration\n"));
  {
   makeHeader(yytext); ;
  }
#undef yythunkpos
#undef yypos
#undef yy
}

YY_RULE(int) yy_end_of_line(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "end_of_line"));
  {  int yypos2= yy->__pos, yythunkpos2= yy->__thunkpos;  if (!yymatchString(yy, "\r\n")) goto l3;  goto l2;
  l3:;	  yy->__pos= yypos2; yy->__thunkpos= yythunkpos2;  if (!yymatchChar(yy, '\n')) goto l4;  goto l2;
  l4:;	  yy->__pos= yypos2; yy->__thunkpos= yythunkpos2;  if (!yymatchChar(yy, '\r')) goto l1;
  }
  l2:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "end_of_line", yy->__buf+yy->__pos));
  return 1;
  l1:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "end_of_line", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_comment(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "comment"));  if (!yymatchChar(yy, '#')) goto l5;
  l6:;	
  {  int yypos7= yy->__pos, yythunkpos7= yy->__thunkpos;
  {  int yypos8= yy->__pos, yythunkpos8= yy->__thunkpos;  if (!yy_end_of_line(yy)) goto l8;  goto l7;
  l8:;	  yy->__pos= yypos8; yy->__thunkpos= yythunkpos8;
  }  if (!yymatchDot(yy)) goto l7;  goto l6;
  l7:;	  yy->__pos= yypos7; yy->__thunkpos= yythunkpos7;
  }  if (!yy_end_of_line(yy)) goto l5;
  yyprintf((stderr, "  ok   %s @ %s\n", "comment", yy->__buf+yy->__pos));
  return 1;
  l5:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "comment", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_space(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "space"));
  {  int yypos10= yy->__pos, yythunkpos10= yy->__thunkpos;  if (!yymatchChar(yy, ' ')) goto l11;  goto l10;
  l11:;	  yy->__pos= yypos10; yy->__thunkpos= yythunkpos10;  if (!yymatchChar(yy, '\t')) goto l12;  goto l10;
  l12:;	  yy->__pos= yypos10; yy->__thunkpos= yythunkpos10;  if (!yy_end_of_line(yy)) goto l9;
  }
  l10:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "space", yy->__buf+yy->__pos));
  return 1;
  l9:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "space", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_braces(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "braces"));
  {  int yypos14= yy->__pos, yythunkpos14= yy->__thunkpos;  if (!yymatchChar(yy, '{')) goto l15;
  l16:;	
  {  int yypos17= yy->__pos, yythunkpos17= yy->__thunkpos;  if (!yy_braces(yy)) goto l17;  goto l16;
  l17:;	  yy->__pos= yypos17; yy->__thunkpos= yythunkpos17;
  }  if (!yymatchChar(yy, '}')) goto l15;  goto l14;
  l15:;	  yy->__pos= yypos14; yy->__thunkpos= yythunkpos14;
  {  int yypos18= yy->__pos, yythunkpos18= yy->__thunkpos;  if (!yymatchChar(yy, '}')) goto l18;  goto l13;
  l18:;	  yy->__pos= yypos18; yy->__thunkpos= yythunkpos18;
  }  if (!yymatchDot(yy)) goto l13;
  }
  l14:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "braces", yy->__buf+yy->__pos));
  return 1;
  l13:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "braces", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_range(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "range"));
  {  int yypos20= yy->__pos, yythunkpos20= yy->__thunkpos;  if (!yy_char(yy)) goto l21;  if (!yymatchChar(yy, '-')) goto l21;  if (!yy_char(yy)) goto l21;  goto l20;
  l21:;	  yy->__pos= yypos20; yy->__thunkpos= yythunkpos20;  if (!yy_char(yy)) goto l19;
  }
  l20:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "range", yy->__buf+yy->__pos));
  return 1;
  l19:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "range", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_char(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "char"));
  {  int yypos23= yy->__pos, yythunkpos23= yy->__thunkpos;  if (!yymatchChar(yy, '\\')) goto l24;  if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\204\040\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")) goto l24;  goto l23;
  l24:;	  yy->__pos= yypos23; yy->__thunkpos= yythunkpos23;  if (!yymatchChar(yy, '\\')) goto l25;  if (!yymatchChar(yy, 'x')) goto l25;  if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25;  if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25;  goto l23;
  l25:;	  yy->__pos= yypos23; yy->__thunkpos= yythunkpos23;  if (!yymatchChar(yy, '\\')) goto l26;  if (!yymatchChar(yy, 'x')) goto l26;  if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l26;  goto l23;
  l26:;	  yy->__pos= yypos23; yy->__thunkpos= yythunkpos23;  if (!yymatchChar(yy, '\\')) goto l27;  if (!yymatchClass(yy, (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")) goto l27;  if (!yymatchClass(yy, (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")) goto l27;  if (!yymatchClass(yy, (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")) goto l27;  goto l23;
  l27:;	  yy->__pos= yypos23; yy->__thunkpos= yythunkpos23;  if (!yymatchChar(yy, '\\')) goto l28;  if (!yymatchClass(yy, (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")) goto l28;
  {  int yypos29= yy->__pos, yythunkpos29= yy->__thunkpos;  if (!yymatchClass(yy, (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")) goto l29;  goto l30;
  l29:;	  yy->__pos= yypos29; yy->__thunkpos= yythunkpos29;
  }
  l30:;	  goto l23;
  l28:;	  yy->__pos= yypos23; yy->__thunkpos= yythunkpos23;
  {  int yypos31= yy->__pos, yythunkpos31= yy->__thunkpos;  if (!yymatchChar(yy, '\\')) goto l31;  goto l22;
  l31:;	  yy->__pos= yypos31; yy->__thunkpos= yythunkpos31;
  }  if (!yymatchDot(yy)) goto l22;
  }
  l23:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "char", yy->__buf+yy->__pos));
  return 1;
  l22:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "char", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_END(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "END"));  if (!yymatchChar(yy, '>')) goto l32;  if (!yy__(yy)) goto l32;
  yyprintf((stderr, "  ok   %s @ %s\n", "END", yy->__buf+yy->__pos));
  return 1;
  l32:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "END", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_BEGIN(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "BEGIN"));  if (!yymatchChar(yy, '<')) goto l33;  if (!yy__(yy)) goto l33;
  yyprintf((stderr, "  ok   %s @ %s\n", "BEGIN", yy->__buf+yy->__pos));
  return 1;
  l33:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "BEGIN", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_DOT(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "DOT"));  if (!yymatchChar(yy, '.')) goto l34;  if (!yy__(yy)) goto l34;
  yyprintf((stderr, "  ok   %s @ %s\n", "DOT", yy->__buf+yy->__pos));
  return 1;
  l34:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "DOT", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_class(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "class"));  if (!yymatchChar(yy, '[')) goto l35;  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l35;
#undef yytext
#undef yyleng
  }
  l36:;	
  {  int yypos37= yy->__pos, yythunkpos37= yy->__thunkpos;
  {  int yypos38= yy->__pos, yythunkpos38= yy->__thunkpos;  if (!yymatchChar(yy, ']')) goto l38;  goto l37;
  l38:;	  yy->__pos= yypos38; yy->__thunkpos= yythunkpos38;
  }  if (!yy_range(yy)) goto l37;  goto l36;
  l37:;	  yy->__pos= yypos37; yy->__thunkpos= yythunkpos37;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l35;
#undef yytext
#undef yyleng
  }  if (!yymatchChar(yy, ']')) goto l35;  if (!yy__(yy)) goto l35;
  yyprintf((stderr, "  ok   %s @ %s\n", "class", yy->__buf+yy->__pos));
  return 1;
  l35:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "class", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_literal(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "literal"));
  {  int yypos40= yy->__pos, yythunkpos40= yy->__thunkpos;  if (!yymatchClass(yy, (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 l41;  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l41;
#undef yytext
#undef yyleng
  }
  l42:;	
  {  int yypos43= yy->__pos, yythunkpos43= yy->__thunkpos;
  {  int yypos44= yy->__pos, yythunkpos44= yy->__thunkpos;  if (!yymatchClass(yy, (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 l44;  goto l43;
  l44:;	  yy->__pos= yypos44; yy->__thunkpos= yythunkpos44;
  }  if (!yy_char(yy)) goto l43;  goto l42;
  l43:;	  yy->__pos= yypos43; yy->__thunkpos= yythunkpos43;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l41;
#undef yytext
#undef yyleng
  }  if (!yymatchClass(yy, (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 l41;  if (!yy__(yy)) goto l41;  goto l40;
  l41:;	  yy->__pos= yypos40; yy->__thunkpos= yythunkpos40;  if (!yymatchClass(yy, (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 l39;  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l39;
#undef yytext
#undef yyleng
  }
  l45:;	
  {  int yypos46= yy->__pos, yythunkpos46= yy->__thunkpos;
  {  int yypos47= yy->__pos, yythunkpos47= yy->__thunkpos;  if (!yymatchClass(yy, (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 l47;  goto l46;
  l47:;	  yy->__pos= yypos47; yy->__thunkpos= yythunkpos47;
  }  if (!yy_char(yy)) goto l46;  goto l45;
  l46:;	  yy->__pos= yypos46; yy->__thunkpos= yythunkpos46;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l39;
#undef yytext
#undef yyleng
  }  if (!yymatchClass(yy, (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 l39;  if (!yy__(yy)) goto l39;
  }
  l40:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "literal", yy->__buf+yy->__pos));
  return 1;
  l39:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "literal", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_CLOSE(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "CLOSE"));  if (!yymatchChar(yy, ')')) goto l48;  if (!yy__(yy)) goto l48;
  yyprintf((stderr, "  ok   %s @ %s\n", "CLOSE", yy->__buf+yy->__pos));
  return 1;
  l48:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "CLOSE", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_OPEN(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "OPEN"));  if (!yymatchChar(yy, '(')) goto l49;  if (!yy__(yy)) goto l49;
  yyprintf((stderr, "  ok   %s @ %s\n", "OPEN", yy->__buf+yy->__pos));
  return 1;
  l49:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "OPEN", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_COLON(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "COLON"));  if (!yymatchChar(yy, ':')) goto l50;  if (!yy__(yy)) goto l50;
  yyprintf((stderr, "  ok   %s @ %s\n", "COLON", yy->__buf+yy->__pos));
  return 1;
  l50:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "COLON", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_PLUS(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "PLUS"));  if (!yymatchChar(yy, '+')) goto l51;  if (!yy__(yy)) goto l51;
  yyprintf((stderr, "  ok   %s @ %s\n", "PLUS", yy->__buf+yy->__pos));
  return 1;
  l51:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "PLUS", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_STAR(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "STAR"));  if (!yymatchChar(yy, '*')) goto l52;  if (!yy__(yy)) goto l52;
  yyprintf((stderr, "  ok   %s @ %s\n", "STAR", yy->__buf+yy->__pos));
  return 1;
  l52:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "STAR", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_QUESTION(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "QUESTION"));  if (!yymatchChar(yy, '?')) goto l53;  if (!yy__(yy)) goto l53;
  yyprintf((stderr, "  ok   %s @ %s\n", "QUESTION", yy->__buf+yy->__pos));
  return 1;
  l53:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "QUESTION", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_primary(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "primary"));
  {  int yypos55= yy->__pos, yythunkpos55= yy->__thunkpos;  if (!yy_identifier(yy)) goto l56;  yyDo(yy, yy_1_primary, yy->__begin, yy->__end);  if (!yy_COLON(yy)) goto l56;  if (!yy_identifier(yy)) goto l56;
  {  int yypos57= yy->__pos, yythunkpos57= yy->__thunkpos;  if (!yy_EQUAL(yy)) goto l57;  goto l56;
  l57:;	  yy->__pos= yypos57; yy->__thunkpos= yythunkpos57;
  }  yyDo(yy, yy_2_primary, yy->__begin, yy->__end);  goto l55;
  l56:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_identifier(yy)) goto l58;
  {  int yypos59= yy->__pos, yythunkpos59= yy->__thunkpos;  if (!yy_EQUAL(yy)) goto l59;  goto l58;
  l59:;	  yy->__pos= yypos59; yy->__thunkpos= yythunkpos59;
  }  yyDo(yy, yy_3_primary, yy->__begin, yy->__end);  goto l55;
  l58:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_OPEN(yy)) goto l60;  if (!yy_expression(yy)) goto l60;  if (!yy_CLOSE(yy)) goto l60;  goto l55;
  l60:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_literal(yy)) goto l61;  yyDo(yy, yy_4_primary, yy->__begin, yy->__end);  goto l55;
  l61:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_class(yy)) goto l62;  yyDo(yy, yy_5_primary, yy->__begin, yy->__end);  goto l55;
  l62:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_DOT(yy)) goto l63;  yyDo(yy, yy_6_primary, yy->__begin, yy->__end);  goto l55;
  l63:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_action(yy)) goto l64;  yyDo(yy, yy_7_primary, yy->__begin, yy->__end);  goto l55;
  l64:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_BEGIN(yy)) goto l65;  yyDo(yy, yy_8_primary, yy->__begin, yy->__end);  goto l55;
  l65:;	  yy->__pos= yypos55; yy->__thunkpos= yythunkpos55;  if (!yy_END(yy)) goto l54;  yyDo(yy, yy_9_primary, yy->__begin, yy->__end);
  }
  l55:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "primary", yy->__buf+yy->__pos));
  return 1;
  l54:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "primary", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_NOT(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "NOT"));  if (!yymatchChar(yy, '!')) goto l66;  if (!yy__(yy)) goto l66;
  yyprintf((stderr, "  ok   %s @ %s\n", "NOT", yy->__buf+yy->__pos));
  return 1;
  l66:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "NOT", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_suffix(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "suffix"));  if (!yy_primary(yy)) goto l67;
  {  int yypos68= yy->__pos, yythunkpos68= yy->__thunkpos;
  {  int yypos70= yy->__pos, yythunkpos70= yy->__thunkpos;  if (!yy_QUESTION(yy)) goto l71;  yyDo(yy, yy_1_suffix, yy->__begin, yy->__end);  goto l70;
  l71:;	  yy->__pos= yypos70; yy->__thunkpos= yythunkpos70;  if (!yy_STAR(yy)) goto l72;  yyDo(yy, yy_2_suffix, yy->__begin, yy->__end);  goto l70;
  l72:;	  yy->__pos= yypos70; yy->__thunkpos= yythunkpos70;  if (!yy_PLUS(yy)) goto l68;  yyDo(yy, yy_3_suffix, yy->__begin, yy->__end);
  }
  l70:;	  goto l69;
  l68:;	  yy->__pos= yypos68; yy->__thunkpos= yythunkpos68;
  }
  l69:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "suffix", yy->__buf+yy->__pos));
  return 1;
  l67:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "suffix", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_AND(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "AND"));  if (!yymatchChar(yy, '&')) goto l73;  if (!yy__(yy)) goto l73;
  yyprintf((stderr, "  ok   %s @ %s\n", "AND", yy->__buf+yy->__pos));
  return 1;
  l73:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "AND", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_action(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "action"));  if (!yymatchChar(yy, '{')) goto l74;  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l74;
#undef yytext
#undef yyleng
  }
  l75:;	
  {  int yypos76= yy->__pos, yythunkpos76= yy->__thunkpos;  if (!yy_braces(yy)) goto l76;  goto l75;
  l76:;	  yy->__pos= yypos76; yy->__thunkpos= yythunkpos76;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l74;
#undef yytext
#undef yyleng
  }  if (!yymatchChar(yy, '}')) goto l74;  if (!yy__(yy)) goto l74;
  yyprintf((stderr, "  ok   %s @ %s\n", "action", yy->__buf+yy->__pos));
  return 1;
  l74:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "action", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_TILDE(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "TILDE"));  if (!yymatchChar(yy, '~')) goto l77;  if (!yy__(yy)) goto l77;
  yyprintf((stderr, "  ok   %s @ %s\n", "TILDE", yy->__buf+yy->__pos));
  return 1;
  l77:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "TILDE", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_prefix(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "prefix"));
  {  int yypos79= yy->__pos, yythunkpos79= yy->__thunkpos;  if (!yy_AND(yy)) goto l80;  if (!yy_action(yy)) goto l80;  yyDo(yy, yy_1_prefix, yy->__begin, yy->__end);  goto l79;
  l80:;	  yy->__pos= yypos79; yy->__thunkpos= yythunkpos79;  if (!yy_AND(yy)) goto l81;  if (!yy_suffix(yy)) goto l81;  yyDo(yy, yy_2_prefix, yy->__begin, yy->__end);  goto l79;
  l81:;	  yy->__pos= yypos79; yy->__thunkpos= yythunkpos79;  if (!yy_NOT(yy)) goto l82;  if (!yy_suffix(yy)) goto l82;  yyDo(yy, yy_3_prefix, yy->__begin, yy->__end);  goto l79;
  l82:;	  yy->__pos= yypos79; yy->__thunkpos= yythunkpos79;  if (!yy_suffix(yy)) goto l78;
  }
  l79:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "prefix", yy->__buf+yy->__pos));
  return 1;
  l78:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "prefix", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_error(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "error"));  if (!yy_prefix(yy)) goto l83;
  {  int yypos84= yy->__pos, yythunkpos84= yy->__thunkpos;  if (!yy_TILDE(yy)) goto l84;  if (!yy_action(yy)) goto l84;  yyDo(yy, yy_1_error, yy->__begin, yy->__end);  goto l85;
  l84:;	  yy->__pos= yypos84; yy->__thunkpos= yythunkpos84;
  }
  l85:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "error", yy->__buf+yy->__pos));
  return 1;
  l83:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "error", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_BAR(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "BAR"));  if (!yymatchChar(yy, '|')) goto l86;  if (!yy__(yy)) goto l86;
  yyprintf((stderr, "  ok   %s @ %s\n", "BAR", yy->__buf+yy->__pos));
  return 1;
  l86:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "BAR", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_sequence(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "sequence"));  if (!yy_error(yy)) goto l87;
  l88:;	
  {  int yypos89= yy->__pos, yythunkpos89= yy->__thunkpos;  if (!yy_error(yy)) goto l89;  yyDo(yy, yy_1_sequence, yy->__begin, yy->__end);  goto l88;
  l89:;	  yy->__pos= yypos89; yy->__thunkpos= yythunkpos89;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "sequence", yy->__buf+yy->__pos));
  return 1;
  l87:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "sequence", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_SEMICOLON(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "SEMICOLON"));  if (!yymatchChar(yy, ';')) goto l90;  if (!yy__(yy)) goto l90;
  yyprintf((stderr, "  ok   %s @ %s\n", "SEMICOLON", yy->__buf+yy->__pos));
  return 1;
  l90:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "SEMICOLON", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_expression(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "expression"));  if (!yy_sequence(yy)) goto l91;
  l92:;	
  {  int yypos93= yy->__pos, yythunkpos93= yy->__thunkpos;  if (!yy_BAR(yy)) goto l93;  if (!yy_sequence(yy)) goto l93;  yyDo(yy, yy_1_expression, yy->__begin, yy->__end);  goto l92;
  l93:;	  yy->__pos= yypos93; yy->__thunkpos= yythunkpos93;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "expression", yy->__buf+yy->__pos));
  return 1;
  l91:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "expression", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_EQUAL(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "EQUAL"));  if (!yymatchChar(yy, '=')) goto l94;  if (!yy__(yy)) goto l94;
  yyprintf((stderr, "  ok   %s @ %s\n", "EQUAL", yy->__buf+yy->__pos));
  return 1;
  l94:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "EQUAL", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_identifier(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "identifier"));  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l95;
#undef yytext
#undef yyleng
  }  if (!yymatchClass(yy, (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")) goto l95;
  l96:;	
  {  int yypos97= yy->__pos, yythunkpos97= yy->__thunkpos;  if (!yymatchClass(yy, (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")) goto l97;  goto l96;
  l97:;	  yy->__pos= yypos97; yy->__thunkpos= yythunkpos97;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l95;
#undef yytext
#undef yyleng
  }  if (!yy__(yy)) goto l95;
  yyprintf((stderr, "  ok   %s @ %s\n", "identifier", yy->__buf+yy->__pos));
  return 1;
  l95:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "identifier", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_RPERCENT(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "RPERCENT"));  if (!yymatchString(yy, "%}")) goto l98;  if (!yy__(yy)) goto l98;
  yyprintf((stderr, "  ok   %s @ %s\n", "RPERCENT", yy->__buf+yy->__pos));
  return 1;
  l98:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "RPERCENT", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_end_of_file(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "end_of_file"));
  {  int yypos100= yy->__pos, yythunkpos100= yy->__thunkpos;  if (!yymatchDot(yy)) goto l100;  goto l99;
  l100:;	  yy->__pos= yypos100; yy->__thunkpos= yythunkpos100;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "end_of_file", yy->__buf+yy->__pos));
  return 1;
  l99:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "end_of_file", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_trailer(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "trailer"));  if (!yymatchString(yy, "%%")) goto l101;  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l101;
#undef yytext
#undef yyleng
  }
  l102:;	
  {  int yypos103= yy->__pos, yythunkpos103= yy->__thunkpos;  if (!yymatchDot(yy)) goto l103;  goto l102;
  l103:;	  yy->__pos= yypos103; yy->__thunkpos= yythunkpos103;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l101;
#undef yytext
#undef yyleng
  }  yyDo(yy, yy_1_trailer, yy->__begin, yy->__end);
  yyprintf((stderr, "  ok   %s @ %s\n", "trailer", yy->__buf+yy->__pos));
  return 1;
  l101:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "trailer", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_definition(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "definition"));  if (!yy_identifier(yy)) goto l104;  yyDo(yy, yy_1_definition, yy->__begin, yy->__end);  if (!yy_EQUAL(yy)) goto l104;  if (!yy_expression(yy)) goto l104;  yyDo(yy, yy_2_definition, yy->__begin, yy->__end);
  {  int yypos105= yy->__pos, yythunkpos105= yy->__thunkpos;  if (!yy_SEMICOLON(yy)) goto l105;  goto l106;
  l105:;	  yy->__pos= yypos105; yy->__thunkpos= yythunkpos105;
  }
  l106:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "definition", yy->__buf+yy->__pos));
  return 1;
  l104:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "definition", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy_declaration(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "declaration"));  if (!yymatchString(yy, "%{")) goto l107;  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l107;
#undef yytext
#undef yyleng
  }
  l108:;	
  {  int yypos109= yy->__pos, yythunkpos109= yy->__thunkpos;
  {  int yypos110= yy->__pos, yythunkpos110= yy->__thunkpos;  if (!yymatchString(yy, "%}")) goto l110;  goto l109;
  l110:;	  yy->__pos= yypos110; yy->__thunkpos= yythunkpos110;
  }  if (!yymatchDot(yy)) goto l109;  goto l108;
  l109:;	  yy->__pos= yypos109; yy->__thunkpos= yythunkpos109;
  }  yyText(yy, yy->__begin, yy->__end);  {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l107;
#undef yytext
#undef yyleng
  }  if (!yy_RPERCENT(yy)) goto l107;  yyDo(yy, yy_1_declaration, yy->__begin, yy->__end);
  yyprintf((stderr, "  ok   %s @ %s\n", "declaration", yy->__buf+yy->__pos));
  return 1;
  l107:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "declaration", yy->__buf+yy->__pos));
  return 0;
}
YY_RULE(int) yy__(yycontext *yy)
{
  yyprintf((stderr, "%s\n", "_"));
  l112:;	
  {  int yypos113= yy->__pos, yythunkpos113= yy->__thunkpos;
  {  int yypos114= yy->__pos, yythunkpos114= yy->__thunkpos;  if (!yy_space(yy)) goto l115;  goto l114;
  l115:;	  yy->__pos= yypos114; yy->__thunkpos= yythunkpos114;  if (!yy_comment(yy)) goto l113;
  }
  l114:;	  goto l112;
  l113:;	  yy->__pos= yypos113; yy->__thunkpos= yythunkpos113;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "_", yy->__buf+yy->__pos));
  return 1;
}
YY_RULE(int) yy_grammar(yycontext *yy)
{  int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
  yyprintf((stderr, "%s\n", "grammar"));  if (!yy__(yy)) goto l116;
  {  int yypos119= yy->__pos, yythunkpos119= yy->__thunkpos;  if (!yy_declaration(yy)) goto l120;  goto l119;
  l120:;	  yy->__pos= yypos119; yy->__thunkpos= yythunkpos119;  if (!yy_definition(yy)) goto l116;
  }
  l119:;	
  l117:;	
  {  int yypos118= yy->__pos, yythunkpos118= yy->__thunkpos;
  {  int yypos121= yy->__pos, yythunkpos121= yy->__thunkpos;  if (!yy_declaration(yy)) goto l122;  goto l121;
  l122:;	  yy->__pos= yypos121; yy->__thunkpos= yythunkpos121;  if (!yy_definition(yy)) goto l118;
  }
  l121:;	  goto l117;
  l118:;	  yy->__pos= yypos118; yy->__thunkpos= yythunkpos118;
  }
  {  int yypos123= yy->__pos, yythunkpos123= yy->__thunkpos;  if (!yy_trailer(yy)) goto l123;  goto l124;
  l123:;	  yy->__pos= yypos123; yy->__thunkpos= yythunkpos123;
  }
  l124:;	  if (!yy_end_of_file(yy)) goto l116;
  yyprintf((stderr, "  ok   %s @ %s\n", "grammar", yy->__buf+yy->__pos));
  return 1;
  l116:;	  yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "grammar", yy->__buf+yy->__pos));
  return 0;
}

#ifndef YY_PART

typedef int (*yyrule)(yycontext *yy);

YY_PARSE(int) YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart)
{
  int yyok;
  if (!yyctx->__buflen)
    {
      yyctx->__buflen= YY_BUFFER_SIZE;
      yyctx->__buf= (char *)YY_MALLOC(yyctx, yyctx->__buflen);
      yyctx->__textlen= YY_BUFFER_SIZE;
      yyctx->__text= (char *)YY_MALLOC(yyctx, yyctx->__textlen);
      yyctx->__thunkslen= YY_STACK_SIZE;
      yyctx->__thunks= (yythunk *)YY_MALLOC(yyctx, sizeof(yythunk) * yyctx->__thunkslen);
      yyctx->__valslen= YY_STACK_SIZE;
      yyctx->__vals= (YYSTYPE *)YY_MALLOC(yyctx, sizeof(YYSTYPE) * yyctx->__valslen);
      yyctx->__begin= yyctx->__end= yyctx->__pos= yyctx->__limit= yyctx->__thunkpos= 0;
    }
  yyctx->__begin= yyctx->__end= yyctx->__pos;
  yyctx->__thunkpos= 0;
  yyctx->__val= yyctx->__vals;
  yyok= yystart(yyctx);
  if (yyok) yyDone(yyctx);
  yyCommit(yyctx);
  return yyok;
}

YY_PARSE(int) YYPARSE(YY_CTX_PARAM)
{
  return YYPARSEFROM(YY_CTX_ARG_ yy_grammar);
}

YY_PARSE(yycontext *) YYRELEASE(yycontext *yyctx)
{
  if (yyctx->__buflen)
    {
      yyctx->__buflen= 0;
      YY_FREE(yyctx, yyctx->__buf);
      YY_FREE(yyctx, yyctx->__text);
      YY_FREE(yyctx, yyctx->__thunks);
      YY_FREE(yyctx, yyctx->__vals);
    }
  return yyctx;
}

#endif


void yyerror(char *message)
{
  fprintf(stderr, "%s:%d: %s", fileName, lineNumber, message);
  if (yyctx->__text[0]) fprintf(stderr, " near token '%s'", yyctx->__text);
  if (yyctx->__pos < yyctx->__limit || !feof(input))
    {
      yyctx->__buf[yyctx->__limit]= '\0';
      fprintf(stderr, " before text \"");
      while (yyctx->__pos < yyctx->__limit)
	{
	  if ('\n' == yyctx->__buf[yyctx->__pos] || '\r' == yyctx->__buf[yyctx->__pos]) break;
	  fputc(yyctx->__buf[yyctx->__pos++], stderr);
	}
      if (yyctx->__pos == yyctx->__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, PEG_MAJOR, PEG_MINOR, PEG_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)
{
  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= 1;
	  break;

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

  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())
	    yyerror("syntax error");
	  if (input != stdin)
	    fclose(input);
	}
    }
  else
    if (!yyparse())
      yyerror("syntax error");

  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;
}

