home: hub: minipeg

ref: 7c4282f079e0b8b2f7c25c2a46256878d841c6f9
dir: /peg.peg-c/

View raw version
/* A recursive-descent parser generated by peg 0.1.0 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define YYRULECOUNT 32
#ifndef YY_VARIABLE
#define YY_VARIABLE(T)	static T
#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 YY_INPUT
#define YY_INPUT(buf, result, max_size)			\
  {							\
    int yyc= getchar();					\
    result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1);	\
    yyprintf((stderr, "<%c>", yyc));			\
  }
#endif
#ifndef YY_BEGIN
#define YY_BEGIN	( yybegin= yypos, 1)
#endif
#ifndef YY_END
#define YY_END		( yyend= yypos, 1)
#endif
#ifdef YY_DEBUG
# define yyprintf(args)	fprintf args
#else
# define yyprintf(args)
#endif
#ifndef YYSTYPE
#define YYSTYPE	int
#endif

#ifndef YY_PART

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

YY_VARIABLE(char *   ) yybuf= 0;
YY_VARIABLE(int	     ) yybuflen= 0;
YY_VARIABLE(int	     ) yypos= 0;
YY_VARIABLE(int	     ) yylimit= 0;
YY_VARIABLE(char *   ) yytext= 0;
YY_VARIABLE(int	     ) yytextlen= 0;
YY_VARIABLE(int	     ) yybegin= 0;
YY_VARIABLE(int	     ) yyend= 0;
YY_VARIABLE(int	     ) yytextmax= 0;
YY_VARIABLE(yythunk *) yythunks= 0;
YY_VARIABLE(int	     ) yythunkslen= 0;
YY_VARIABLE(int      ) yythunkpos= 0;
YY_VARIABLE(YYSTYPE  ) yy;
YY_VARIABLE(YYSTYPE *) yyval= 0;
YY_VARIABLE(YYSTYPE *) yyvals= 0;
YY_VARIABLE(int      ) yyvalslen= 0;

YY_LOCAL(int) yyrefill(void)
{
  int yyn;
  if (yybuflen - yypos < 512)
    {
      yybuflen *= 2;
      yybuf= realloc(yybuf, yybuflen);
    }
  YY_INPUT((yybuf + yypos), yyn, (yybuflen - yypos));
  if (!yyn) return 0;
  yylimit += yyn;
  return 1;
}

YY_LOCAL(int) yymatchDot(void)
{
  if (yypos >= yylimit && !yyrefill()) return 0;
  ++yypos;
  return 1;
}

YY_LOCAL(int) yymatchChar(int c)
{
  if (yypos >= yylimit && !yyrefill()) return 0;
  if (yybuf[yypos] == c)
    {
      ++yypos;
      yyprintf((stderr, "  ok   yymatchChar(%c) @ %s\n", c, yybuf+yypos));
      return 1;
    }
  yyprintf((stderr, "  fail yymatchChar(%c) @ %s\n", c, yybuf+yypos));
  return 0;
}

YY_LOCAL(int) yymatchString(char *s)
{
  int yysav= yypos;
  while (*s)
    {
      if (yypos >= yylimit && !yyrefill()) return 0;
      if (yybuf[yypos] != *s)
        {
          yypos= yysav;
          return 0;
        }
      ++s;
      ++yypos;
    }
  return 1;
}

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

YY_LOCAL(void) yyDo(yyaction action, int begin, int end)
{
  if (yythunkpos >= yythunkslen)
    {
      yythunkslen *= 2;
      yythunks= realloc(yythunks, sizeof(yythunk) * yythunkslen);
    }
  yythunks[yythunkpos].begin=  begin;
  yythunks[yythunkpos].end=    end;
  yythunks[yythunkpos].action= action;
  ++yythunkpos;
}

YY_LOCAL(int) yyText(int begin, int end)
{
  int yyleng= end - begin;
  if (yyleng <= 0)
    yyleng= 0;
  else
    {
      if (yytextlen < (yyleng - 1))
	{
	  yytextlen *= 2;
	  yytext= realloc(yytext, yytextlen);
	}
      memcpy(yytext, yybuf + begin, yyleng);
    }
  yytext[yyleng]= '\0';
  return yyleng;
}

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

YY_LOCAL(void) yyCommit()
{
  if ((yylimit -= yypos))
    {
      memmove(yybuf, yybuf + yypos, yylimit);
    }
  yybegin -= yypos;
  yyend -= yypos;
  yypos= yythunkpos= 0;
}

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

YY_LOCAL(void) yyPush(char *text, int count)	{ yyval += count; }
YY_LOCAL(void) yyPop(char *text, int count)	{ yyval -= count; }
YY_LOCAL(void) yySet(char *text, int count)	{ yyval[count]= yy; }

#endif /* YY_PART */

#define	YYACCEPT	yyAccept(yythunkpos0)

YY_RULE(int) yy_EndOfLine(); /* 32 */
YY_RULE(int) yy_Comment(); /* 31 */
YY_RULE(int) yy_Space(); /* 30 */
YY_RULE(int) yy_Range(); /* 29 */
YY_RULE(int) yy_Char(); /* 28 */
YY_RULE(int) yy_IdentCont(); /* 27 */
YY_RULE(int) yy_IdentStart(); /* 26 */
YY_RULE(int) yy_END(); /* 25 */
YY_RULE(int) yy_BEGIN(); /* 24 */
YY_RULE(int) yy_DOT(); /* 23 */
YY_RULE(int) yy_Class(); /* 22 */
YY_RULE(int) yy_Literal(); /* 21 */
YY_RULE(int) yy_CLOSE(); /* 20 */
YY_RULE(int) yy_OPEN(); /* 19 */
YY_RULE(int) yy_PLUS(); /* 18 */
YY_RULE(int) yy_STAR(); /* 17 */
YY_RULE(int) yy_QUESTION(); /* 16 */
YY_RULE(int) yy_Primary(); /* 15 */
YY_RULE(int) yy_NOT(); /* 14 */
YY_RULE(int) yy_Suffix(); /* 13 */
YY_RULE(int) yy_Action(); /* 12 */
YY_RULE(int) yy_AND(); /* 11 */
YY_RULE(int) yy_Prefix(); /* 10 */
YY_RULE(int) yy_SLASH(); /* 9 */
YY_RULE(int) yy_Sequence(); /* 8 */
YY_RULE(int) yy_Expression(); /* 7 */
YY_RULE(int) yy_LEFTARROW(); /* 6 */
YY_RULE(int) yy_Identifier(); /* 5 */
YY_RULE(int) yy_EndOfFile(); /* 4 */
YY_RULE(int) yy_Definition(); /* 3 */
YY_RULE(int) yy_Spacing(); /* 2 */
YY_RULE(int) yy_Grammar(); /* 1 */

YY_ACTION(void) yy_7_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_7_Primary\n"));
   push(makePredicate("YY_END")); ;
}
YY_ACTION(void) yy_6_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_6_Primary\n"));
   push(makePredicate("YY_BEGIN")); ;
}
YY_ACTION(void) yy_5_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_5_Primary\n"));
   push(makeAction(yytext)); ;
}
YY_ACTION(void) yy_4_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_4_Primary\n"));
   push(makeDot()); ;
}
YY_ACTION(void) yy_3_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_3_Primary\n"));
   push(makeClass(yytext)); ;
}
YY_ACTION(void) yy_2_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_Primary\n"));
   push(makeString(yytext)); ;
}
YY_ACTION(void) yy_1_Primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_Primary\n"));
   push(makeName(findRule(yytext))); ;
}
YY_ACTION(void) yy_3_Suffix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_3_Suffix\n"));
   push(makePlus (pop())); ;
}
YY_ACTION(void) yy_2_Suffix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_Suffix\n"));
   push(makeStar (pop())); ;
}
YY_ACTION(void) yy_1_Suffix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_Suffix\n"));
   push(makeQuery(pop())); ;
}
YY_ACTION(void) yy_3_Prefix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_3_Prefix\n"));
   push(makePeekNot(pop())); ;
}
YY_ACTION(void) yy_2_Prefix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_Prefix\n"));
   push(makePeekFor(pop())); ;
}
YY_ACTION(void) yy_1_Prefix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_Prefix\n"));
   push(makePredicate(yytext)); ;
}
YY_ACTION(void) yy_2_Sequence(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_Sequence\n"));
   push(makePredicate("1")); ;
}
YY_ACTION(void) yy_1_Sequence(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_Sequence\n"));
   Node *f= pop();  push(Sequence_append(pop(), f)); ;
}
YY_ACTION(void) yy_1_Expression(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_Expression\n"));
   Node *f= pop();  push(Alternate_append(pop(), f)); ;
}
YY_ACTION(void) yy_2_Definition(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_Definition\n"));
   Node *e= pop();  Rule_setExpression(pop(), e); ;
}
YY_ACTION(void) yy_1_Definition(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_Definition\n"));
   if (push(beginRule(findRule(yytext)))->rule.expression) fprintf(stderr, "rule '%s' redefined\n", yytext); ;
}

YY_RULE(int) yy_EndOfLine()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "EndOfLine"));
  {  int yypos2= yypos, yythunkpos2= yythunkpos;  if (!yymatchString("\r\n")) goto l3;  goto l2;
  l3:;	  yypos= yypos2; yythunkpos= yythunkpos2;  if (!yymatchChar('\n')) goto l4;  goto l2;
  l4:;	  yypos= yypos2; yythunkpos= yythunkpos2;  if (!yymatchChar('\r')) goto l1;
  }
  l2:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "EndOfLine", yybuf+yypos));
  return 1;
  l1:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "EndOfLine", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Comment()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Comment"));  if (!yymatchChar('#')) goto l5;
  l6:;	
  {  int yypos7= yypos, yythunkpos7= yythunkpos;
  {  int yypos8= yypos, yythunkpos8= yythunkpos;  if (!yy_EndOfLine()) goto l8;  goto l7;
  l8:;	  yypos= yypos8; yythunkpos= yythunkpos8;
  }  if (!yymatchDot()) goto l7;  goto l6;
  l7:;	  yypos= yypos7; yythunkpos= yythunkpos7;
  }  if (!yy_EndOfLine()) goto l5;
  yyprintf((stderr, "  ok   %s @ %s\n", "Comment", yybuf+yypos));
  return 1;
  l5:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Comment", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Space()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Space"));
  {  int yypos10= yypos, yythunkpos10= yythunkpos;  if (!yymatchChar(' ')) goto l11;  goto l10;
  l11:;	  yypos= yypos10; yythunkpos= yythunkpos10;  if (!yymatchChar('\t')) goto l12;  goto l10;
  l12:;	  yypos= yypos10; yythunkpos= yythunkpos10;  if (!yy_EndOfLine()) goto l9;
  }
  l10:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Space", yybuf+yypos));
  return 1;
  l9:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Space", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Range()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Range"));
  {  int yypos14= yypos, yythunkpos14= yythunkpos;  if (!yy_Char()) goto l15;  if (!yymatchChar('-')) goto l15;  if (!yy_Char()) goto l15;  goto l14;
  l15:;	  yypos= yypos14; yythunkpos= yythunkpos14;  if (!yy_Char()) goto l13;
  }
  l14:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Range", yybuf+yypos));
  return 1;
  l13:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Range", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Char()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Char"));
  {  int yypos17= yypos, yythunkpos17= yythunkpos;  if (!yymatchChar('\\')) goto l18;  if (!yymatchClass((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")) goto l18;  goto l17;
  l18:;	  yypos= yypos17; yythunkpos= yythunkpos17;  if (!yymatchChar('\\')) goto l19;  if (!yymatchClass((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 l19;  if (!yymatchClass((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 l19;  if (!yymatchClass((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 l19;  goto l17;
  l19:;	  yypos= yypos17; yythunkpos= yythunkpos17;  if (!yymatchChar('\\')) goto l20;  if (!yymatchClass((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 l20;
  {  int yypos21= yypos, yythunkpos21= yythunkpos;  if (!yymatchClass((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 l21;  goto l22;
  l21:;	  yypos= yypos21; yythunkpos= yythunkpos21;
  }
  l22:;	  goto l17;
  l20:;	  yypos= yypos17; yythunkpos= yythunkpos17;  if (!yymatchChar('\\')) goto l23;  if (!yymatchChar('-')) goto l23;  goto l17;
  l23:;	  yypos= yypos17; yythunkpos= yythunkpos17;
  {  int yypos24= yypos, yythunkpos24= yythunkpos;  if (!yymatchChar('\\')) goto l24;  goto l16;
  l24:;	  yypos= yypos24; yythunkpos= yythunkpos24;
  }  if (!yymatchDot()) goto l16;
  }
  l17:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Char", yybuf+yypos));
  return 1;
  l16:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Char", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_IdentCont()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "IdentCont"));
  {  int yypos26= yypos, yythunkpos26= yythunkpos;  if (!yy_IdentStart()) goto l27;  goto l26;
  l27:;	  yypos= yypos26; yythunkpos= yythunkpos26;  if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\003\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 l25;
  }
  l26:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "IdentCont", yybuf+yypos));
  return 1;
  l25:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "IdentCont", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_IdentStart()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "IdentStart"));  if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\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 l28;
  yyprintf((stderr, "  ok   %s @ %s\n", "IdentStart", yybuf+yypos));
  return 1;
  l28:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "IdentStart", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_END()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "END"));  if (!yymatchChar('>')) goto l29;  if (!yy_Spacing()) goto l29;
  yyprintf((stderr, "  ok   %s @ %s\n", "END", yybuf+yypos));
  return 1;
  l29:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "END", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_BEGIN()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "BEGIN"));  if (!yymatchChar('<')) goto l30;  if (!yy_Spacing()) goto l30;
  yyprintf((stderr, "  ok   %s @ %s\n", "BEGIN", yybuf+yypos));
  return 1;
  l30:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "BEGIN", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_DOT()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "DOT"));  if (!yymatchChar('.')) goto l31;  if (!yy_Spacing()) goto l31;
  yyprintf((stderr, "  ok   %s @ %s\n", "DOT", yybuf+yypos));
  return 1;
  l31:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "DOT", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Class()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Class"));  if (!yymatchChar('[')) goto l32;  yyText(yybegin, yyend);  if (!(YY_BEGIN)) goto l32;
  l33:;	
  {  int yypos34= yypos, yythunkpos34= yythunkpos;
  {  int yypos35= yypos, yythunkpos35= yythunkpos;  if (!yymatchChar(']')) goto l35;  goto l34;
  l35:;	  yypos= yypos35; yythunkpos= yythunkpos35;
  }  if (!yy_Range()) goto l34;  goto l33;
  l34:;	  yypos= yypos34; yythunkpos= yythunkpos34;
  }  yyText(yybegin, yyend);  if (!(YY_END)) goto l32;  if (!yymatchChar(']')) goto l32;  if (!yy_Spacing()) goto l32;
  yyprintf((stderr, "  ok   %s @ %s\n", "Class", yybuf+yypos));
  return 1;
  l32:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Class", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Literal()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Literal"));
  {  int yypos37= yypos, yythunkpos37= yythunkpos;  if (!yymatchClass((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 l38;  yyText(yybegin, yyend);  if (!(YY_BEGIN)) goto l38;
  l39:;	
  {  int yypos40= yypos, yythunkpos40= yythunkpos;
  {  int yypos41= yypos, yythunkpos41= yythunkpos;  if (!yymatchClass((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;  goto l40;
  l41:;	  yypos= yypos41; yythunkpos= yythunkpos41;
  }  if (!yy_Char()) goto l40;  goto l39;
  l40:;	  yypos= yypos40; yythunkpos= yythunkpos40;
  }  yyText(yybegin, yyend);  if (!(YY_END)) goto l38;  if (!yymatchClass((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 l38;  if (!yy_Spacing()) goto l38;  goto l37;
  l38:;	  yypos= yypos37; yythunkpos= yythunkpos37;  if (!yymatchClass((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 l36;  yyText(yybegin, yyend);  if (!(YY_BEGIN)) goto l36;
  l42:;	
  {  int yypos43= yypos, yythunkpos43= yythunkpos;
  {  int yypos44= yypos, yythunkpos44= yythunkpos;  if (!yymatchClass((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 l44;  goto l43;
  l44:;	  yypos= yypos44; yythunkpos= yythunkpos44;
  }  if (!yy_Char()) goto l43;  goto l42;
  l43:;	  yypos= yypos43; yythunkpos= yythunkpos43;
  }  yyText(yybegin, yyend);  if (!(YY_END)) goto l36;  if (!yymatchClass((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 l36;  if (!yy_Spacing()) goto l36;
  }
  l37:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Literal", yybuf+yypos));
  return 1;
  l36:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Literal", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_CLOSE()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "CLOSE"));  if (!yymatchChar(')')) goto l45;  if (!yy_Spacing()) goto l45;
  yyprintf((stderr, "  ok   %s @ %s\n", "CLOSE", yybuf+yypos));
  return 1;
  l45:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "CLOSE", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_OPEN()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "OPEN"));  if (!yymatchChar('(')) goto l46;  if (!yy_Spacing()) goto l46;
  yyprintf((stderr, "  ok   %s @ %s\n", "OPEN", yybuf+yypos));
  return 1;
  l46:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "OPEN", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_PLUS()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "PLUS"));  if (!yymatchChar('+')) goto l47;  if (!yy_Spacing()) goto l47;
  yyprintf((stderr, "  ok   %s @ %s\n", "PLUS", yybuf+yypos));
  return 1;
  l47:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "PLUS", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_STAR()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "STAR"));  if (!yymatchChar('*')) goto l48;  if (!yy_Spacing()) goto l48;
  yyprintf((stderr, "  ok   %s @ %s\n", "STAR", yybuf+yypos));
  return 1;
  l48:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "STAR", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_QUESTION()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "QUESTION"));  if (!yymatchChar('?')) goto l49;  if (!yy_Spacing()) goto l49;
  yyprintf((stderr, "  ok   %s @ %s\n", "QUESTION", yybuf+yypos));
  return 1;
  l49:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "QUESTION", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Primary()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Primary"));
  {  int yypos51= yypos, yythunkpos51= yythunkpos;  if (!yy_Identifier()) goto l52;
  {  int yypos53= yypos, yythunkpos53= yythunkpos;  if (!yy_LEFTARROW()) goto l53;  goto l52;
  l53:;	  yypos= yypos53; yythunkpos= yythunkpos53;
  }  yyDo(yy_1_Primary, yybegin, yyend);  goto l51;
  l52:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_OPEN()) goto l54;  if (!yy_Expression()) goto l54;  if (!yy_CLOSE()) goto l54;  goto l51;
  l54:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_Literal()) goto l55;  yyDo(yy_2_Primary, yybegin, yyend);  goto l51;
  l55:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_Class()) goto l56;  yyDo(yy_3_Primary, yybegin, yyend);  goto l51;
  l56:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_DOT()) goto l57;  yyDo(yy_4_Primary, yybegin, yyend);  goto l51;
  l57:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_Action()) goto l58;  yyDo(yy_5_Primary, yybegin, yyend);  goto l51;
  l58:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_BEGIN()) goto l59;  yyDo(yy_6_Primary, yybegin, yyend);  goto l51;
  l59:;	  yypos= yypos51; yythunkpos= yythunkpos51;  if (!yy_END()) goto l50;  yyDo(yy_7_Primary, yybegin, yyend);
  }
  l51:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Primary", yybuf+yypos));
  return 1;
  l50:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Primary", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_NOT()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "NOT"));  if (!yymatchChar('!')) goto l60;  if (!yy_Spacing()) goto l60;
  yyprintf((stderr, "  ok   %s @ %s\n", "NOT", yybuf+yypos));
  return 1;
  l60:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "NOT", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Suffix()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Suffix"));  if (!yy_Primary()) goto l61;
  {  int yypos62= yypos, yythunkpos62= yythunkpos;
  {  int yypos64= yypos, yythunkpos64= yythunkpos;  if (!yy_QUESTION()) goto l65;  yyDo(yy_1_Suffix, yybegin, yyend);  goto l64;
  l65:;	  yypos= yypos64; yythunkpos= yythunkpos64;  if (!yy_STAR()) goto l66;  yyDo(yy_2_Suffix, yybegin, yyend);  goto l64;
  l66:;	  yypos= yypos64; yythunkpos= yythunkpos64;  if (!yy_PLUS()) goto l62;  yyDo(yy_3_Suffix, yybegin, yyend);
  }
  l64:;	  goto l63;
  l62:;	  yypos= yypos62; yythunkpos= yythunkpos62;
  }
  l63:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Suffix", yybuf+yypos));
  return 1;
  l61:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Suffix", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Action()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Action"));  if (!yymatchChar('{')) goto l67;  yyText(yybegin, yyend);  if (!(YY_BEGIN)) goto l67;
  l68:;	
  {  int yypos69= yypos, yythunkpos69= yythunkpos;  if (!yymatchClass((unsigned char *)"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\337\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l69;  goto l68;
  l69:;	  yypos= yypos69; yythunkpos= yythunkpos69;
  }  yyText(yybegin, yyend);  if (!(YY_END)) goto l67;  if (!yymatchChar('}')) goto l67;  if (!yy_Spacing()) goto l67;
  yyprintf((stderr, "  ok   %s @ %s\n", "Action", yybuf+yypos));
  return 1;
  l67:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Action", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_AND()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "AND"));  if (!yymatchChar('&')) goto l70;  if (!yy_Spacing()) goto l70;
  yyprintf((stderr, "  ok   %s @ %s\n", "AND", yybuf+yypos));
  return 1;
  l70:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "AND", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Prefix()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Prefix"));
  {  int yypos72= yypos, yythunkpos72= yythunkpos;  if (!yy_AND()) goto l73;  if (!yy_Action()) goto l73;  yyDo(yy_1_Prefix, yybegin, yyend);  goto l72;
  l73:;	  yypos= yypos72; yythunkpos= yythunkpos72;  if (!yy_AND()) goto l74;  if (!yy_Suffix()) goto l74;  yyDo(yy_2_Prefix, yybegin, yyend);  goto l72;
  l74:;	  yypos= yypos72; yythunkpos= yythunkpos72;  if (!yy_NOT()) goto l75;  if (!yy_Suffix()) goto l75;  yyDo(yy_3_Prefix, yybegin, yyend);  goto l72;
  l75:;	  yypos= yypos72; yythunkpos= yythunkpos72;  if (!yy_Suffix()) goto l71;
  }
  l72:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Prefix", yybuf+yypos));
  return 1;
  l71:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Prefix", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_SLASH()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "SLASH"));  if (!yymatchChar('/')) goto l76;  if (!yy_Spacing()) goto l76;
  yyprintf((stderr, "  ok   %s @ %s\n", "SLASH", yybuf+yypos));
  return 1;
  l76:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "SLASH", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Sequence()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Sequence"));
  {  int yypos78= yypos, yythunkpos78= yythunkpos;  if (!yy_Prefix()) goto l79;
  l80:;	
  {  int yypos81= yypos, yythunkpos81= yythunkpos;  if (!yy_Prefix()) goto l81;  yyDo(yy_1_Sequence, yybegin, yyend);  goto l80;
  l81:;	  yypos= yypos81; yythunkpos= yythunkpos81;
  }  goto l78;
  l79:;	  yypos= yypos78; yythunkpos= yythunkpos78;  yyDo(yy_2_Sequence, yybegin, yyend);
  }
  l78:;	
  yyprintf((stderr, "  ok   %s @ %s\n", "Sequence", yybuf+yypos));
  return 1;
  l77:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Sequence", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Expression()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Expression"));  if (!yy_Sequence()) goto l82;
  l83:;	
  {  int yypos84= yypos, yythunkpos84= yythunkpos;  if (!yy_SLASH()) goto l84;  if (!yy_Sequence()) goto l84;  yyDo(yy_1_Expression, yybegin, yyend);  goto l83;
  l84:;	  yypos= yypos84; yythunkpos= yythunkpos84;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "Expression", yybuf+yypos));
  return 1;
  l82:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Expression", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_LEFTARROW()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "LEFTARROW"));  if (!yymatchString("<-")) goto l85;  if (!yy_Spacing()) goto l85;
  yyprintf((stderr, "  ok   %s @ %s\n", "LEFTARROW", yybuf+yypos));
  return 1;
  l85:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "LEFTARROW", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Identifier()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Identifier"));  yyText(yybegin, yyend);  if (!(YY_BEGIN)) goto l86;  if (!yy_IdentStart()) goto l86;
  l87:;	
  {  int yypos88= yypos, yythunkpos88= yythunkpos;  if (!yy_IdentCont()) goto l88;  goto l87;
  l88:;	  yypos= yypos88; yythunkpos= yythunkpos88;
  }  yyText(yybegin, yyend);  if (!(YY_END)) goto l86;  if (!yy_Spacing()) goto l86;
  yyprintf((stderr, "  ok   %s @ %s\n", "Identifier", yybuf+yypos));
  return 1;
  l86:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Identifier", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_EndOfFile()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "EndOfFile"));
  {  int yypos90= yypos, yythunkpos90= yythunkpos;  if (!yymatchDot()) goto l90;  goto l89;
  l90:;	  yypos= yypos90; yythunkpos= yythunkpos90;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "EndOfFile", yybuf+yypos));
  return 1;
  l89:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "EndOfFile", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Definition()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Definition"));  if (!yy_Identifier()) goto l91;  yyDo(yy_1_Definition, yybegin, yyend);  if (!yy_LEFTARROW()) goto l91;  if (!yy_Expression()) goto l91;  yyDo(yy_2_Definition, yybegin, yyend);  yyText(yybegin, yyend);  if (!( YYACCEPT )) goto l91;
  yyprintf((stderr, "  ok   %s @ %s\n", "Definition", yybuf+yypos));
  return 1;
  l91:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Definition", yybuf+yypos));
  return 0;
}
YY_RULE(int) yy_Spacing()
{
  yyprintf((stderr, "%s\n", "Spacing"));
  l93:;	
  {  int yypos94= yypos, yythunkpos94= yythunkpos;
  {  int yypos95= yypos, yythunkpos95= yythunkpos;  if (!yy_Space()) goto l96;  goto l95;
  l96:;	  yypos= yypos95; yythunkpos= yythunkpos95;  if (!yy_Comment()) goto l94;
  }
  l95:;	  goto l93;
  l94:;	  yypos= yypos94; yythunkpos= yythunkpos94;
  }
  yyprintf((stderr, "  ok   %s @ %s\n", "Spacing", yybuf+yypos));
  return 1;
}
YY_RULE(int) yy_Grammar()
{  int yypos0= yypos, yythunkpos0= yythunkpos;
  yyprintf((stderr, "%s\n", "Grammar"));  if (!yy_Spacing()) goto l97;  if (!yy_Definition()) goto l97;
  l98:;	
  {  int yypos99= yypos, yythunkpos99= yythunkpos;  if (!yy_Definition()) goto l99;  goto l98;
  l99:;	  yypos= yypos99; yythunkpos= yythunkpos99;
  }  if (!yy_EndOfFile()) goto l97;
  yyprintf((stderr, "  ok   %s @ %s\n", "Grammar", yybuf+yypos));
  return 1;
  l97:;	  yypos= yypos0; yythunkpos= yythunkpos0;
  yyprintf((stderr, "  fail %s @ %s\n", "Grammar", yybuf+yypos));
  return 0;
}

#ifndef YY_PART

typedef int (*yyrule)();

YY_PARSE(int) YYPARSEFROM(yyrule yystart)
{
  int yyok;
  if (!yybuflen)
    {
      yybuflen= 1024;
      yybuf= malloc(yybuflen);
      yytextlen= 1024;
      yytext= malloc(yytextlen);
      yythunkslen= 32;
      yythunks= malloc(sizeof(yythunk) * yythunkslen);
      yyvalslen= 32;
      yyvals= malloc(sizeof(YYSTYPE) * yyvalslen);
      yybegin= yyend= yypos= yylimit= yythunkpos= 0;
    }
  yybegin= yyend= yypos;
  yythunkpos= 0;
  yyval= yyvals;
  yyok= yystart();
  if (yyok) yyDone();
  yyCommit();
  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) YYPARSE(void)
{
  return YYPARSEFROM(yy_Grammar);
}

#endif