Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fb5bf6578e
Fetching contributors…

Cannot retrieve contributors at this time

1153 lines (1083 sloc) 41.946 kb
/* A recursive-descent parser generated by cdescent 0.0.1 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct _CDESCENT;
#define YYRULECOUNT 36
#include "cdescent.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 lineno= 0;
static char *filename= 0;
static char *trailer= 0;
static Header *headers= 0;
void makeHeader(char *text);
void makeTrailer(char *text);
void yyerror(struct _CDESCENT *, char *message);
#define YY_INPUT(buf, result, max) {\
int c= getc(input); \
if ('\n' == c || '\r' == c) ++lineno; \
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) \
{ \
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
# define yyprintf(args) fprintf args
#else
# define yyprintf(args)
#endif
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#ifndef YY_XTYPE
#define YY_XTYPE void *
#endif
#ifndef YY_XVAR
#define YY_XVAR yydata
#endif
#ifndef YY_PART
#define yy G->ss
typedef void (*yyaction)(struct _CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR);
typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;
typedef struct _CDESCENT {
char *buf;
int buflen;
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;
} CDESCENT;
YY_LOCAL(int) yyrefill(CDESCENT *G)
{
int yyn;
YY_XTYPE YY_XVAR = (YY_XTYPE)G->data;
while (G->buflen - G->pos < 512)
{
G->buflen *= 2;
G->buf= YY_REALLOC(G->buf, G->buflen, G->data);
}
YY_INPUT((G->buf + G->pos), yyn, (G->buflen - G->pos));
if (!yyn) return 0;
G->limit += yyn;
return 1;
}
YY_LOCAL(int) yymatchDot(CDESCENT *G)
{
if (G->pos >= G->limit && !yyrefill(G)) return 0;
++G->pos;
return 1;
}
YY_LOCAL(int) yymatchChar(CDESCENT *G, int c)
{
if (G->pos >= G->limit && !yyrefill(G)) return 0;
if ((unsigned char)G->buf[G->pos] == c)
{
++G->pos;
yyprintf((stderr, " ok yymatchChar(%c) @ %s\n", c, G->buf+G->pos));
return 1;
}
yyprintf((stderr, " fail yymatchChar(%c) @ %s\n", c, G->buf+G->pos));
return 0;
}
YY_LOCAL(int) yymatchString(CDESCENT *G, 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(CDESCENT *G, unsigned char *bits)
{
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\n", G->buf+G->pos));
return 1;
}
yyprintf((stderr, " fail yymatchClass @ %s\n", G->buf+G->pos));
return 0;
}
YY_LOCAL(void) yyDo(CDESCENT *G, yyaction action, int begin, int end)
{
while (G->thunkpos >= G->thunkslen)
{
G->thunkslen *= 2;
G->thunks= 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->thunkpos;
}
YY_LOCAL(int) yyText(CDESCENT *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= 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(CDESCENT *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] %p %s\n", pos, thunk->action, G->text));
thunk->action(G, G->text, yyleng, G->data);
}
G->thunkpos= 0;
}
YY_LOCAL(void) yyCommit(CDESCENT *G)
{
if ((G->limit -= G->pos))
{
memmove(G->buf, G->buf + G->pos, G->limit);
}
G->begin -= G->pos;
G->end -= G->pos;
G->pos= G->thunkpos= 0;
}
YY_LOCAL(int) yyAccept(CDESCENT *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(CDESCENT *G, char *text, int count, 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= YY_REALLOC((void *)G->vals, sizeof(YYSTYPE) * G->valslen, G->data);
G->val= G->vals + off;
} else {
G->val += count;
}
}
YY_LOCAL(void) yyPop(CDESCENT *G, char *text, int count, YY_XTYPE YY_XVAR) { G->val -= count; }
YY_LOCAL(void) yySet(CDESCENT *G, char *text, int count, YY_XTYPE YY_XVAR) { G->val[count]= G->ss; }
#endif /* YY_PART */
#define YYACCEPT yyAccept(G, yythunkpos0)
YY_RULE(int) yy_end_of_line(CDESCENT *G); /* 36 */
YY_RULE(int) yy_comment(CDESCENT *G); /* 35 */
YY_RULE(int) yy_space(CDESCENT *G); /* 34 */
YY_RULE(int) yy_braces(CDESCENT *G); /* 33 */
YY_RULE(int) yy_range(CDESCENT *G); /* 32 */
YY_RULE(int) yy_char(CDESCENT *G); /* 31 */
YY_RULE(int) yy_END(CDESCENT *G); /* 30 */
YY_RULE(int) yy_BEGIN(CDESCENT *G); /* 29 */
YY_RULE(int) yy_DOT(CDESCENT *G); /* 28 */
YY_RULE(int) yy_class(CDESCENT *G); /* 27 */
YY_RULE(int) yy_literal(CDESCENT *G); /* 26 */
YY_RULE(int) yy_CLOSE(CDESCENT *G); /* 25 */
YY_RULE(int) yy_OPEN(CDESCENT *G); /* 24 */
YY_RULE(int) yy_PLUS(CDESCENT *G); /* 23 */
YY_RULE(int) yy_STAR(CDESCENT *G); /* 22 */
YY_RULE(int) yy_QUESTION(CDESCENT *G); /* 21 */
YY_RULE(int) yy_primary(CDESCENT *G); /* 20 */
YY_RULE(int) yy_NOT(CDESCENT *G); /* 19 */
YY_RULE(int) yy_suffix(CDESCENT *G); /* 18 */
YY_RULE(int) yy_action(CDESCENT *G); /* 17 */
YY_RULE(int) yy_AND(CDESCENT *G); /* 16 */
YY_RULE(int) yy_prefix(CDESCENT *G); /* 15 */
YY_RULE(int) yy_BAR(CDESCENT *G); /* 14 */
YY_RULE(int) yy_sequence(CDESCENT *G); /* 13 */
YY_RULE(int) yy_SEMICOLON(CDESCENT *G); /* 12 */
YY_RULE(int) yy_expression(CDESCENT *G); /* 11 */
YY_RULE(int) yy_COLON(CDESCENT *G); /* 10 */
YY_RULE(int) yy_EQUAL(CDESCENT *G); /* 9 */
YY_RULE(int) yy_identifier(CDESCENT *G); /* 8 */
YY_RULE(int) yy_RPERCENT(CDESCENT *G); /* 7 */
YY_RULE(int) yy_end_of_file(CDESCENT *G); /* 6 */
YY_RULE(int) yy_trailer(CDESCENT *G); /* 5 */
YY_RULE(int) yy_definition(CDESCENT *G); /* 4 */
YY_RULE(int) yy_declaration(CDESCENT *G); /* 3 */
YY_RULE(int) yy__(CDESCENT *G); /* 2 */
YY_RULE(int) yy_grammar(CDESCENT *G); /* 1 */
YY_ACTION(void) yy_9_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_9_primary\n"));
push(makePredicate("YY_END")); ;
}
YY_ACTION(void) yy_8_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_8_primary\n"));
push(makePredicate("YY_BEGIN")); ;
}
YY_ACTION(void) yy_7_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_7_primary\n"));
push(makeAction(yytext)); ;
}
YY_ACTION(void) yy_6_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_6_primary\n"));
push(makeDot()); ;
}
YY_ACTION(void) yy_5_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_5_primary\n"));
push(makeClass(yytext)); ;
}
YY_ACTION(void) yy_4_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_4_primary\n"));
push(makeString(yytext)); ;
}
YY_ACTION(void) yy_3_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_3_primary\n"));
push(makeName(findRule(yytext, 0))); ;
}
YY_ACTION(void) yy_2_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_2_primary\n"));
Node *name= makeName(findRule(yytext, 0)); name->name.variable= pop(); push(name); ;
}
YY_ACTION(void) yy_1_primary(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_primary\n"));
push(makeVariable(yytext)); ;
}
YY_ACTION(void) yy_3_suffix(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_3_suffix\n"));
push(makePlus (pop())); ;
}
YY_ACTION(void) yy_2_suffix(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_2_suffix\n"));
push(makeStar (pop())); ;
}
YY_ACTION(void) yy_1_suffix(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_suffix\n"));
push(makeQuery(pop())); ;
}
YY_ACTION(void) yy_3_prefix(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_3_prefix\n"));
push(makePeekNot(pop())); ;
}
YY_ACTION(void) yy_2_prefix(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_2_prefix\n"));
push(makePeekFor(pop())); ;
}
YY_ACTION(void) yy_1_prefix(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_prefix\n"));
push(makePredicate(yytext)); ;
}
YY_ACTION(void) yy_1_sequence(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_sequence\n"));
Node *f= pop(); push(Sequence_append(pop(), f)); ;
}
YY_ACTION(void) yy_1_expression(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_expression\n"));
Node *f= pop(); push(Alternate_append(pop(), f)); ;
}
YY_ACTION(void) yy_2_definition(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
#define s G->val[-1]
yyprintf((stderr, "do yy_2_definition\n"));
Node *e= pop(); Rule_setExpression(pop(), e); ;
#undef s
}
YY_ACTION(void) yy_1_definition(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
#define s G->val[-1]
yyprintf((stderr, "do yy_1_definition\n"));
if (push(beginRule(findRule(yytext, s)))->rule.expression)
fprintf(stderr, "rule '%s' redefined\n", yytext); ;
#undef s
}
YY_ACTION(void) yy_1_trailer(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_trailer\n"));
makeTrailer(yytext); ;
}
YY_ACTION(void) yy_1_declaration(CDESCENT *G, char *yytext, int yyleng, YY_XTYPE YY_XVAR)
{
yyprintf((stderr, "do yy_1_declaration\n"));
makeHeader(yytext); ;
}
YY_RULE(int) yy_end_of_line(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((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 %s @ %s\n", "end_of_line", G->buf+G->pos));
return 1;
l1:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "end_of_line", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_comment(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((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 %s @ %s\n", "comment", G->buf+G->pos));
return 1;
l5:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "comment", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_space(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((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 %s @ %s\n", "space", G->buf+G->pos));
return 1;
l9:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "space", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_braces(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((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 %s @ %s\n", "braces", G->buf+G->pos));
return 1;
l13:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "braces", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_range(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((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 %s @ %s\n", "range", G->buf+G->pos));
return 1;
l20:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "range", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_char(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "char"));
{ int yypos24= G->pos, yythunkpos24= G->thunkpos; if (!yymatchChar(G, '\\')) goto l25; if (!yymatchClass(G, (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 l25; goto l24;
l25:; G->pos= yypos24; G->thunkpos= yythunkpos24; if (!yymatchChar(G, '\\')) goto l26; if (!yymatchClass(G, (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 l26; if (!yymatchClass(G, (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 l26; if (!yymatchClass(G, (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 l26; goto l24;
l26:; G->pos= yypos24; G->thunkpos= yythunkpos24; if (!yymatchChar(G, '\\')) goto l27; if (!yymatchClass(G, (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;
{ int yypos28= G->pos, yythunkpos28= G->thunkpos; if (!yymatchClass(G, (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; 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 %s @ %s\n", "char", G->buf+G->pos));
return 1;
l23:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "char", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_END(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "END")); if (!yymatchChar(G, '>')) goto l31; if (!yy__(G)) goto l31;
yyprintf((stderr, " ok %s @ %s\n", "END", G->buf+G->pos));
return 1;
l31:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "END", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_BEGIN(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "BEGIN")); if (!yymatchChar(G, '<')) goto l32; if (!yy__(G)) goto l32;
yyprintf((stderr, " ok %s @ %s\n", "BEGIN", G->buf+G->pos));
return 1;
l32:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "BEGIN", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_DOT(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "DOT")); if (!yymatchChar(G, '.')) goto l33; if (!yy__(G)) goto l33;
yyprintf((stderr, " ok %s @ %s\n", "DOT", G->buf+G->pos));
return 1;
l33:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "DOT", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_class(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "class")); if (!yymatchChar(G, '[')) goto l34; yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l34;
l35:;
{ int yypos36= G->pos, yythunkpos36= G->thunkpos;
{ int yypos37= G->pos, yythunkpos37= G->thunkpos; if (!yymatchChar(G, ']')) goto l37; goto l36;
l37:; G->pos= yypos37; G->thunkpos= yythunkpos37;
} if (!yy_range(G)) goto l36; goto l35;
l36:; G->pos= yypos36; G->thunkpos= yythunkpos36;
} yyText(G, G->begin, G->end); if (!(YY_END)) goto l34; if (!yymatchChar(G, ']')) goto l34; if (!yy__(G)) goto l34;
yyprintf((stderr, " ok %s @ %s\n", "class", G->buf+G->pos));
return 1;
l34:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "class", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_literal(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "literal"));
{ int yypos39= G->pos, yythunkpos39= G->thunkpos; if (!yymatchClass(G, (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 l40; yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l40;
l41:;
{ int yypos42= G->pos, yythunkpos42= G->thunkpos;
{ int yypos43= G->pos, yythunkpos43= G->thunkpos; if (!yymatchClass(G, (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; goto l42;
l43:; G->pos= yypos43; G->thunkpos= yythunkpos43;
} if (!yy_char(G)) goto l42; goto l41;
l42:; G->pos= yypos42; G->thunkpos= yythunkpos42;
} yyText(G, G->begin, G->end); if (!(YY_END)) goto l40; if (!yymatchClass(G, (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 l40; if (!yy__(G)) goto l40; goto l39;
l40:; G->pos= yypos39; G->thunkpos= yythunkpos39; if (!yymatchClass(G, (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 l38; yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l38;
l44:;
{ int yypos45= G->pos, yythunkpos45= G->thunkpos;
{ int yypos46= G->pos, yythunkpos46= G->thunkpos; if (!yymatchClass(G, (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 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 l38; if (!yymatchClass(G, (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 l38; if (!yy__(G)) goto l38;
}
l39:;
yyprintf((stderr, " ok %s @ %s\n", "literal", G->buf+G->pos));
return 1;
l38:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "literal", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_CLOSE(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(G, ')')) goto l47; if (!yy__(G)) goto l47;
yyprintf((stderr, " ok %s @ %s\n", "CLOSE", G->buf+G->pos));
return 1;
l47:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "CLOSE", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_OPEN(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar(G, '(')) goto l48; if (!yy__(G)) goto l48;
yyprintf((stderr, " ok %s @ %s\n", "OPEN", G->buf+G->pos));
return 1;
l48:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "OPEN", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_PLUS(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar(G, '+')) goto l49; if (!yy__(G)) goto l49;
yyprintf((stderr, " ok %s @ %s\n", "PLUS", G->buf+G->pos));
return 1;
l49:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "PLUS", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_STAR(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "STAR")); if (!yymatchChar(G, '*')) goto l50; if (!yy__(G)) goto l50;
yyprintf((stderr, " ok %s @ %s\n", "STAR", G->buf+G->pos));
return 1;
l50:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "STAR", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_QUESTION(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "QUESTION")); if (!yymatchChar(G, '?')) goto l51; if (!yy__(G)) goto l51;
yyprintf((stderr, " ok %s @ %s\n", "QUESTION", G->buf+G->pos));
return 1;
l51:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "QUESTION", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_primary(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "primary"));
{ int yypos53= G->pos, yythunkpos53= G->thunkpos; if (!yy_identifier(G)) goto l54; yyDo(G, yy_1_primary, G->begin, G->end); if (!yy_COLON(G)) goto l54; if (!yy_identifier(G)) goto l54;
{ int yypos55= G->pos, yythunkpos55= G->thunkpos; if (!yy_EQUAL(G)) goto l55; goto l54;
l55:; G->pos= yypos55; G->thunkpos= yythunkpos55;
} yyDo(G, yy_2_primary, G->begin, G->end); goto l53;
l54:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_identifier(G)) goto l56;
{ int yypos57= G->pos, yythunkpos57= G->thunkpos; if (!yy_EQUAL(G)) goto l57; goto l56;
l57:; G->pos= yypos57; G->thunkpos= yythunkpos57;
} yyDo(G, yy_3_primary, G->begin, G->end); goto l53;
l56:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_OPEN(G)) goto l58; if (!yy_expression(G)) goto l58; if (!yy_CLOSE(G)) goto l58; goto l53;
l58:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_literal(G)) goto l59; yyDo(G, yy_4_primary, G->begin, G->end); goto l53;
l59:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_class(G)) goto l60; yyDo(G, yy_5_primary, G->begin, G->end); goto l53;
l60:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_DOT(G)) goto l61; yyDo(G, yy_6_primary, G->begin, G->end); goto l53;
l61:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_action(G)) goto l62; yyDo(G, yy_7_primary, G->begin, G->end); goto l53;
l62:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_BEGIN(G)) goto l63; yyDo(G, yy_8_primary, G->begin, G->end); goto l53;
l63:; G->pos= yypos53; G->thunkpos= yythunkpos53; if (!yy_END(G)) goto l52; yyDo(G, yy_9_primary, G->begin, G->end);
}
l53:;
yyprintf((stderr, " ok %s @ %s\n", "primary", G->buf+G->pos));
return 1;
l52:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "primary", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_NOT(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "NOT")); if (!yymatchChar(G, '!')) goto l64; if (!yy__(G)) goto l64;
yyprintf((stderr, " ok %s @ %s\n", "NOT", G->buf+G->pos));
return 1;
l64:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "NOT", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_suffix(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "suffix")); if (!yy_primary(G)) goto l65;
{ int yypos66= G->pos, yythunkpos66= G->thunkpos;
{ int yypos68= G->pos, yythunkpos68= G->thunkpos; if (!yy_QUESTION(G)) goto l69; yyDo(G, yy_1_suffix, G->begin, G->end); goto l68;
l69:; G->pos= yypos68; G->thunkpos= yythunkpos68; if (!yy_STAR(G)) goto l70; yyDo(G, yy_2_suffix, G->begin, G->end); goto l68;
l70:; G->pos= yypos68; G->thunkpos= yythunkpos68; if (!yy_PLUS(G)) goto l66; yyDo(G, yy_3_suffix, G->begin, G->end);
}
l68:; goto l67;
l66:; G->pos= yypos66; G->thunkpos= yythunkpos66;
}
l67:;
yyprintf((stderr, " ok %s @ %s\n", "suffix", G->buf+G->pos));
return 1;
l65:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "suffix", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_action(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "action")); if (!yymatchChar(G, '{')) goto l71; yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l71;
l72:;
{ int yypos73= G->pos, yythunkpos73= G->thunkpos; if (!yy_braces(G)) goto l73; goto l72;
l73:; G->pos= yypos73; G->thunkpos= yythunkpos73;
} yyText(G, G->begin, G->end); if (!(YY_END)) goto l71; if (!yymatchChar(G, '}')) goto l71; if (!yy__(G)) goto l71;
yyprintf((stderr, " ok %s @ %s\n", "action", G->buf+G->pos));
return 1;
l71:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "action", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_AND(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "AND")); if (!yymatchChar(G, '&')) goto l74; if (!yy__(G)) goto l74;
yyprintf((stderr, " ok %s @ %s\n", "AND", G->buf+G->pos));
return 1;
l74:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "AND", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_prefix(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "prefix"));
{ int yypos76= G->pos, yythunkpos76= G->thunkpos; if (!yy_AND(G)) goto l77; if (!yy_action(G)) goto l77; yyDo(G, yy_1_prefix, G->begin, G->end); goto l76;
l77:; G->pos= yypos76; G->thunkpos= yythunkpos76; if (!yy_AND(G)) goto l78; if (!yy_suffix(G)) goto l78; yyDo(G, yy_2_prefix, G->begin, G->end); goto l76;
l78:; G->pos= yypos76; G->thunkpos= yythunkpos76; if (!yy_NOT(G)) goto l79; if (!yy_suffix(G)) goto l79; yyDo(G, yy_3_prefix, G->begin, G->end); goto l76;
l79:; G->pos= yypos76; G->thunkpos= yythunkpos76; if (!yy_suffix(G)) goto l75;
}
l76:;
yyprintf((stderr, " ok %s @ %s\n", "prefix", G->buf+G->pos));
return 1;
l75:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "prefix", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_BAR(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "BAR")); if (!yymatchChar(G, '|')) goto l80; if (!yy__(G)) goto l80;
yyprintf((stderr, " ok %s @ %s\n", "BAR", G->buf+G->pos));
return 1;
l80:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "BAR", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_sequence(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "sequence")); if (!yy_prefix(G)) goto l81;
l82:;
{ int yypos83= G->pos, yythunkpos83= G->thunkpos; if (!yy_prefix(G)) goto l83; yyDo(G, yy_1_sequence, G->begin, G->end); goto l82;
l83:; G->pos= yypos83; G->thunkpos= yythunkpos83;
}
yyprintf((stderr, " ok %s @ %s\n", "sequence", G->buf+G->pos));
return 1;
l81:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "sequence", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_SEMICOLON(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "SEMICOLON")); if (!yymatchChar(G, ';')) goto l84; if (!yy__(G)) goto l84;
yyprintf((stderr, " ok %s @ %s\n", "SEMICOLON", G->buf+G->pos));
return 1;
l84:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "SEMICOLON", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_expression(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "expression")); if (!yy_sequence(G)) goto l85;
l86:;
{ int yypos87= G->pos, yythunkpos87= G->thunkpos; if (!yy_BAR(G)) goto l87; if (!yy_sequence(G)) goto l87; yyDo(G, yy_1_expression, G->begin, G->end); goto l86;
l87:; G->pos= yypos87; G->thunkpos= yythunkpos87;
}
yyprintf((stderr, " ok %s @ %s\n", "expression", G->buf+G->pos));
return 1;
l85:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "expression", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_COLON(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "COLON")); if (!yymatchChar(G, ':')) goto l88; if (!yy__(G)) goto l88;
yyprintf((stderr, " ok %s @ %s\n", "COLON", G->buf+G->pos));
return 1;
l88:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "COLON", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_EQUAL(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "EQUAL")); if (!yymatchChar(G, '=')) goto l89; if (!yy__(G)) goto l89;
yyprintf((stderr, " ok %s @ %s\n", "EQUAL", G->buf+G->pos));
return 1;
l89:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "EQUAL", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_identifier(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "identifier")); yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l90; if (!yymatchClass(G, (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 l90;
l91:;
{ int yypos92= G->pos, yythunkpos92= G->thunkpos; if (!yymatchClass(G, (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 l92; goto l91;
l92:; G->pos= yypos92; G->thunkpos= yythunkpos92;
} yyText(G, G->begin, G->end); if (!(YY_END)) goto l90; if (!yy__(G)) goto l90;
yyprintf((stderr, " ok %s @ %s\n", "identifier", G->buf+G->pos));
return 1;
l90:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "identifier", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_RPERCENT(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "RPERCENT")); if (!yymatchString(G, "%}")) goto l93; if (!yy__(G)) goto l93;
yyprintf((stderr, " ok %s @ %s\n", "RPERCENT", G->buf+G->pos));
return 1;
l93:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "RPERCENT", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_end_of_file(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "end_of_file"));
{ int yypos95= G->pos, yythunkpos95= G->thunkpos; if (!yymatchDot(G)) goto l95; goto l94;
l95:; G->pos= yypos95; G->thunkpos= yythunkpos95;
}
yyprintf((stderr, " ok %s @ %s\n", "end_of_file", G->buf+G->pos));
return 1;
l94:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "end_of_file", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_trailer(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "trailer")); if (!yymatchString(G, "%%")) goto l96; yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l96;
l97:;
{ int yypos98= G->pos, yythunkpos98= G->thunkpos; if (!yymatchDot(G)) goto l98; goto l97;
l98:; G->pos= yypos98; G->thunkpos= yythunkpos98;
} yyText(G, G->begin, G->end); if (!(YY_END)) goto l96; yyDo(G, yy_1_trailer, G->begin, G->end);
yyprintf((stderr, " ok %s @ %s\n", "trailer", G->buf+G->pos));
return 1;
l96:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "trailer", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_definition(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos; yyDo(G, yyPush, 1, 0);
yyprintf((stderr, "%s\n", "definition")); if (!yy_identifier(G)) goto l99; yyDo(G, yySet, -1, 0); yyDo(G, yy_1_definition, G->begin, G->end);
{ int yypos100= G->pos, yythunkpos100= G->thunkpos; if (!yy_EQUAL(G)) goto l101; goto l100;
l101:; G->pos= yypos100; G->thunkpos= yythunkpos100; if (!yy_COLON(G)) goto l99;
}
l100:; if (!yy_expression(G)) goto l99; yyDo(G, yy_2_definition, G->begin, G->end);
{ int yypos102= G->pos, yythunkpos102= G->thunkpos; if (!yy_SEMICOLON(G)) goto l102; goto l103;
l102:; G->pos= yypos102; G->thunkpos= yythunkpos102;
}
l103:;
yyprintf((stderr, " ok %s @ %s\n", "definition", G->buf+G->pos)); yyDo(G, yyPop, 1, 0);
return 1;
l99:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "definition", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy_declaration(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "declaration")); if (!yymatchString(G, "%{")) goto l104; yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l104;
l105:;
{ int yypos106= G->pos, yythunkpos106= G->thunkpos;
{ int yypos107= G->pos, yythunkpos107= G->thunkpos; if (!yymatchString(G, "%}")) goto l107; goto l106;
l107:; G->pos= yypos107; G->thunkpos= yythunkpos107;
} if (!yymatchDot(G)) goto l106; goto l105;
l106:; G->pos= yypos106; G->thunkpos= yythunkpos106;
} yyText(G, G->begin, G->end); if (!(YY_END)) goto l104; if (!yy_RPERCENT(G)) goto l104; yyDo(G, yy_1_declaration, G->begin, G->end);
yyprintf((stderr, " ok %s @ %s\n", "declaration", G->buf+G->pos));
return 1;
l104:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "declaration", G->buf+G->pos));
return 0;
}
YY_RULE(int) yy__(CDESCENT *G)
{
yyprintf((stderr, "%s\n", "_"));
l109:;
{ int yypos110= G->pos, yythunkpos110= G->thunkpos;
{ int yypos111= G->pos, yythunkpos111= G->thunkpos; if (!yy_space(G)) goto l112; goto l111;
l112:; G->pos= yypos111; G->thunkpos= yythunkpos111; if (!yy_comment(G)) goto l110;
}
l111:; goto l109;
l110:; G->pos= yypos110; G->thunkpos= yythunkpos110;
}
yyprintf((stderr, " ok %s @ %s\n", "_", G->buf+G->pos));
return 1;
}
YY_RULE(int) yy_grammar(CDESCENT *G)
{ int yypos0= G->pos, yythunkpos0= G->thunkpos;
yyprintf((stderr, "%s\n", "grammar")); if (!yy__(G)) goto l113;
{ int yypos116= G->pos, yythunkpos116= G->thunkpos; if (!yy_declaration(G)) goto l117; goto l116;
l117:; G->pos= yypos116; G->thunkpos= yythunkpos116; if (!yy_definition(G)) goto l113;
}
l116:;
l114:;
{ int yypos115= G->pos, yythunkpos115= G->thunkpos;
{ int yypos118= G->pos, yythunkpos118= G->thunkpos; if (!yy_declaration(G)) goto l119; goto l118;
l119:; G->pos= yypos118; G->thunkpos= yythunkpos118; if (!yy_definition(G)) goto l115;
}
l118:; goto l114;
l115:; G->pos= yypos115; G->thunkpos= yythunkpos115;
}
{ int yypos120= G->pos, yythunkpos120= G->thunkpos; if (!yy_trailer(G)) goto l120; goto l121;
l120:; G->pos= yypos120; G->thunkpos= yythunkpos120;
}
l121:; if (!yy_end_of_file(G)) goto l113;
yyprintf((stderr, " ok %s @ %s\n", "grammar", G->buf+G->pos));
return 1;
l113:; G->pos= yypos0; G->thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "grammar", G->buf+G->pos));
return 0;
}
#ifndef YY_PART
typedef int (*yyrule)(CDESCENT *G);
YY_PARSE(int) YY_NAME(parse_from)(CDESCENT *G, yyrule yystart)
{
int yyok;
if (!G->buflen)
{
G->buflen= 1024;
G->buf= YY_ALLOC(G->buflen, G->data);
G->textlen= 1024;
G->text= YY_ALLOC(G->textlen, G->data);
G->thunkslen= 32;
G->thunks= YY_ALLOC(sizeof(yythunk) * G->thunkslen, G->data);
G->valslen= 32;
G->vals= YY_ALLOC(sizeof(YYSTYPE) * G->valslen, G->data);
G->begin= G->end= G->pos= G->limit= G->thunkpos= 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)(CDESCENT *G)
{
return YY_NAME(parse_from)(G, yy_grammar);
}
YY_PARSE(CDESCENT *) YY_NAME(parse_new)(YY_XTYPE data)
{
CDESCENT *G = (CDESCENT *)YY_CALLOC(1, sizeof(CDESCENT), G->data);
G->data = data;
return G;
}
YY_PARSE(void) YY_NAME(parse_free)(CDESCENT *G)
{
YY_FREE(G);
}
#endif
void
yyerror(struct _CDESCENT *G, char *message) {
fprintf(stderr, "%s:%d: %s", filename, lineno, 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);
}
/*
* Output cDescent version.
*/
static void
version() {
printf("%s\n", CDESCENT_VERSION);
}
/*
* Output usage information.
*/
static void
usage(char *name) {
fprintf(stderr,
"\n"
" usage: %s [options] <file ...>\n"
"\n"
" options:\n"
"\n"
" -h output help information\n"
" -o <file> output to <file>\n"
" -v enable verbose output\n"
" -V output version number\n"
"\n"
" examples:\n"
"\n"
" $ cdescent < in.g > out.c\n"
"\n"
, name);
exit(1);
}
/*
* Parse arguments.
*/
int
main(int argc, char **argv) {
CDESCENT *G;
Node *n;
int c;
output = stdout;
input = stdin;
lineno = 1;
filename = "<stdin>";
while (-1 != (c= getopt(argc, argv, "Vho:v")))
{
switch (c)
{
case 'V':
version();
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;
G = yyparse_new(NULL);
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;
}
lineno= 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;
}
Jump to Line
Something went wrong with that request. Please try again.