mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
3be22536df
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5953 b45a01b8-16f6-495d-af2f-9b41ad6348cc
1210 lines
44 KiB
C
1210 lines
44 KiB
C
/* A recursive-descent parser generated by peg 0.1.9 */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#define YYRULECOUNT 36
|
|
|
|
# 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_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 ( ctx->begin= ctx->pos, 1)
|
|
#endif
|
|
#ifndef YY_END
|
|
#define YY_END ( ctx->end= ctx->pos, 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 struct _yycontext yycontext;
|
|
typedef void (*yyaction)(yycontext *ctx, 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 yy;
|
|
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
|
|
#else
|
|
#define YY_CTX_PARAM_
|
|
#define YY_CTX_PARAM
|
|
#define YY_CTX_ARG_
|
|
#define YY_CTX_ARG
|
|
yycontext yyctx0;
|
|
yycontext *yyctx= &yyctx0;
|
|
#endif
|
|
|
|
YY_LOCAL(int) yyrefill(yycontext *ctx)
|
|
{
|
|
int yyn;
|
|
while (ctx->buflen - ctx->pos < 512)
|
|
{
|
|
ctx->buflen *= 2;
|
|
ctx->buf= (char *)realloc(ctx->buf, ctx->buflen);
|
|
}
|
|
YY_INPUT((ctx->buf + ctx->pos), yyn, (ctx->buflen - ctx->pos));
|
|
if (!yyn) return 0;
|
|
ctx->limit += yyn;
|
|
return 1;
|
|
}
|
|
|
|
YY_LOCAL(int) yymatchDot(yycontext *ctx)
|
|
{
|
|
if (ctx->pos >= ctx->limit && !yyrefill(ctx)) return 0;
|
|
++ctx->pos;
|
|
return 1;
|
|
}
|
|
|
|
YY_LOCAL(int) yymatchChar(yycontext *ctx, int c)
|
|
{
|
|
if (ctx->pos >= ctx->limit && !yyrefill(ctx)) return 0;
|
|
if ((unsigned char)ctx->buf[ctx->pos] == c)
|
|
{
|
|
++ctx->pos;
|
|
yyprintf((stderr, " ok yymatchChar(ctx, %c) @ %s\n", c, ctx->buf+ctx->pos));
|
|
return 1;
|
|
}
|
|
yyprintf((stderr, " fail yymatchChar(ctx, %c) @ %s\n", c, ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
|
|
YY_LOCAL(int) yymatchString(yycontext *ctx, char *s)
|
|
{
|
|
int yysav= ctx->pos;
|
|
while (*s)
|
|
{
|
|
if (ctx->pos >= ctx->limit && !yyrefill(ctx)) return 0;
|
|
if (ctx->buf[ctx->pos] != *s)
|
|
{
|
|
ctx->pos= yysav;
|
|
return 0;
|
|
}
|
|
++s;
|
|
++ctx->pos;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
YY_LOCAL(int) yymatchClass(yycontext *ctx, unsigned char *bits)
|
|
{
|
|
int c;
|
|
if (ctx->pos >= ctx->limit && !yyrefill(ctx)) return 0;
|
|
c= (unsigned char)ctx->buf[ctx->pos];
|
|
if (bits[c >> 3] & (1 << (c & 7)))
|
|
{
|
|
++ctx->pos;
|
|
yyprintf((stderr, " ok yymatchClass @ %s\n", ctx->buf+ctx->pos));
|
|
return 1;
|
|
}
|
|
yyprintf((stderr, " fail yymatchClass @ %s\n", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
|
|
YY_LOCAL(void) yyDo(yycontext *ctx, yyaction action, int begin, int end)
|
|
{
|
|
while (ctx->thunkpos >= ctx->thunkslen)
|
|
{
|
|
ctx->thunkslen *= 2;
|
|
ctx->thunks= (yythunk *)realloc(ctx->thunks, sizeof(yythunk) * ctx->thunkslen);
|
|
}
|
|
ctx->thunks[ctx->thunkpos].begin= begin;
|
|
ctx->thunks[ctx->thunkpos].end= end;
|
|
ctx->thunks[ctx->thunkpos].action= action;
|
|
++ctx->thunkpos;
|
|
}
|
|
|
|
YY_LOCAL(int) yyText(yycontext *ctx, int begin, int end)
|
|
{
|
|
int yyleng= end - begin;
|
|
if (yyleng <= 0)
|
|
yyleng= 0;
|
|
else
|
|
{
|
|
while (ctx->textlen < (yyleng + 1))
|
|
{
|
|
ctx->textlen *= 2;
|
|
ctx->text= (char *)realloc(ctx->text, ctx->textlen);
|
|
}
|
|
memcpy(ctx->text, ctx->buf + begin, yyleng);
|
|
}
|
|
ctx->text[yyleng]= '\0';
|
|
return yyleng;
|
|
}
|
|
|
|
YY_LOCAL(void) yyDone(yycontext *ctx)
|
|
{
|
|
int pos;
|
|
for (pos= 0; pos < ctx->thunkpos; ++pos)
|
|
{
|
|
yythunk *thunk= &ctx->thunks[pos];
|
|
int yyleng= thunk->end ? yyText(ctx, thunk->begin, thunk->end) : thunk->begin;
|
|
yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, ctx->text));
|
|
thunk->action(ctx, ctx->text, yyleng);
|
|
}
|
|
ctx->thunkpos= 0;
|
|
}
|
|
|
|
YY_LOCAL(void) yyCommit(yycontext *ctx)
|
|
{
|
|
if ((ctx->limit -= ctx->pos))
|
|
{
|
|
memmove(ctx->buf, ctx->buf + ctx->pos, ctx->limit);
|
|
}
|
|
ctx->begin -= ctx->pos;
|
|
ctx->end -= ctx->pos;
|
|
ctx->pos= ctx->thunkpos= 0;
|
|
}
|
|
|
|
YY_LOCAL(int) yyAccept(yycontext *ctx, int tp0)
|
|
{
|
|
if (tp0)
|
|
{
|
|
fprintf(stderr, "accept denied at %d\n", tp0);
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
yyDone(ctx);
|
|
yyCommit(ctx);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
YY_LOCAL(void) yyPush(yycontext *ctx, char *text, int count) { ctx->val += count; }
|
|
YY_LOCAL(void) yyPop(yycontext *ctx, char *text, int count) { ctx->val -= count; }
|
|
YY_LOCAL(void) yySet(yycontext *ctx, char *text, int count) { ctx->val[count]= ctx->yy; }
|
|
|
|
#endif /* YY_PART */
|
|
|
|
#define YYACCEPT yyAccept(ctx, yythunkpos0)
|
|
|
|
YY_RULE(int) yy_end_of_line(yycontext *ctx); /* 36 */
|
|
YY_RULE(int) yy_comment(yycontext *ctx); /* 35 */
|
|
YY_RULE(int) yy_space(yycontext *ctx); /* 34 */
|
|
YY_RULE(int) yy_braces(yycontext *ctx); /* 33 */
|
|
YY_RULE(int) yy_range(yycontext *ctx); /* 32 */
|
|
YY_RULE(int) yy_char(yycontext *ctx); /* 31 */
|
|
YY_RULE(int) yy_END(yycontext *ctx); /* 30 */
|
|
YY_RULE(int) yy_BEGIN(yycontext *ctx); /* 29 */
|
|
YY_RULE(int) yy_DOT(yycontext *ctx); /* 28 */
|
|
YY_RULE(int) yy_class(yycontext *ctx); /* 27 */
|
|
YY_RULE(int) yy_literal(yycontext *ctx); /* 26 */
|
|
YY_RULE(int) yy_CLOSE(yycontext *ctx); /* 25 */
|
|
YY_RULE(int) yy_OPEN(yycontext *ctx); /* 24 */
|
|
YY_RULE(int) yy_COLON(yycontext *ctx); /* 23 */
|
|
YY_RULE(int) yy_PLUS(yycontext *ctx); /* 22 */
|
|
YY_RULE(int) yy_STAR(yycontext *ctx); /* 21 */
|
|
YY_RULE(int) yy_QUESTION(yycontext *ctx); /* 20 */
|
|
YY_RULE(int) yy_primary(yycontext *ctx); /* 19 */
|
|
YY_RULE(int) yy_NOT(yycontext *ctx); /* 18 */
|
|
YY_RULE(int) yy_suffix(yycontext *ctx); /* 17 */
|
|
YY_RULE(int) yy_action(yycontext *ctx); /* 16 */
|
|
YY_RULE(int) yy_AND(yycontext *ctx); /* 15 */
|
|
YY_RULE(int) yy_prefix(yycontext *ctx); /* 14 */
|
|
YY_RULE(int) yy_BAR(yycontext *ctx); /* 13 */
|
|
YY_RULE(int) yy_sequence(yycontext *ctx); /* 12 */
|
|
YY_RULE(int) yy_SEMICOLON(yycontext *ctx); /* 11 */
|
|
YY_RULE(int) yy_expression(yycontext *ctx); /* 10 */
|
|
YY_RULE(int) yy_EQUAL(yycontext *ctx); /* 9 */
|
|
YY_RULE(int) yy_identifier(yycontext *ctx); /* 8 */
|
|
YY_RULE(int) yy_RPERCENT(yycontext *ctx); /* 7 */
|
|
YY_RULE(int) yy_end_of_file(yycontext *ctx); /* 6 */
|
|
YY_RULE(int) yy_trailer(yycontext *ctx); /* 5 */
|
|
YY_RULE(int) yy_definition(yycontext *ctx); /* 4 */
|
|
YY_RULE(int) yy_declaration(yycontext *ctx); /* 3 */
|
|
YY_RULE(int) yy__(yycontext *ctx); /* 2 */
|
|
YY_RULE(int) yy_grammar(yycontext *ctx); /* 1 */
|
|
|
|
YY_ACTION(void) yy_9_primary(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_7_primary\n"));
|
|
push(makeAction(yytext)); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_6_primary(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_6_primary\n"));
|
|
push(makeDot()); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_5_primary(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_5_primary\n"));
|
|
push(makeClass(yytext)); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_4_primary(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_4_primary\n"));
|
|
push(makeString(yytext)); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_3_primary(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_1_primary\n"));
|
|
push(makeVariable(yytext)); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_3_suffix(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_3_suffix\n"));
|
|
push(makePlus (pop())); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_2_suffix(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_2_suffix\n"));
|
|
push(makeStar (pop())); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_1_suffix(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_1_suffix\n"));
|
|
push(makeQuery(pop())); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_3_prefix(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_3_prefix\n"));
|
|
push(makePeekNot(pop())); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_2_prefix(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_2_prefix\n"));
|
|
push(makePeekFor(pop())); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_1_prefix(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_1_prefix\n"));
|
|
push(makePredicate(yytext)); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_1_sequence(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->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 *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_1_trailer\n"));
|
|
makeTrailer(yytext); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
YY_ACTION(void) yy_1_declaration(yycontext *ctx, char *yytext, int yyleng)
|
|
{
|
|
#define yy ctx->yy
|
|
#define yypos ctx->pos
|
|
#define yythunkpos ctx->thunkpos
|
|
yyprintf((stderr, "do yy_1_declaration\n"));
|
|
makeHeader(yytext); ;
|
|
#undef yythunkpos
|
|
#undef yypos
|
|
#undef yy
|
|
}
|
|
|
|
YY_RULE(int) yy_end_of_line(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "end_of_line"));
|
|
{ int yypos2= ctx->pos, yythunkpos2= ctx->thunkpos; if (!yymatchString(ctx, "\r\n")) goto l3; goto l2;
|
|
l3:; ctx->pos= yypos2; ctx->thunkpos= yythunkpos2; if (!yymatchChar(ctx, '\n')) goto l4; goto l2;
|
|
l4:; ctx->pos= yypos2; ctx->thunkpos= yythunkpos2; if (!yymatchChar(ctx, '\r')) goto l1;
|
|
}
|
|
l2:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "end_of_line", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l1:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "end_of_line", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_comment(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "comment")); if (!yymatchChar(ctx, '#')) goto l5;
|
|
l6:;
|
|
{ int yypos7= ctx->pos, yythunkpos7= ctx->thunkpos;
|
|
{ int yypos8= ctx->pos, yythunkpos8= ctx->thunkpos; if (!yy_end_of_line(ctx)) goto l8; goto l7;
|
|
l8:; ctx->pos= yypos8; ctx->thunkpos= yythunkpos8;
|
|
} if (!yymatchDot(ctx)) goto l7; goto l6;
|
|
l7:; ctx->pos= yypos7; ctx->thunkpos= yythunkpos7;
|
|
} if (!yy_end_of_line(ctx)) goto l5;
|
|
yyprintf((stderr, " ok %s @ %s\n", "comment", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l5:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "comment", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_space(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "space"));
|
|
{ int yypos10= ctx->pos, yythunkpos10= ctx->thunkpos; if (!yymatchChar(ctx, ' ')) goto l11; goto l10;
|
|
l11:; ctx->pos= yypos10; ctx->thunkpos= yythunkpos10; if (!yymatchChar(ctx, '\t')) goto l12; goto l10;
|
|
l12:; ctx->pos= yypos10; ctx->thunkpos= yythunkpos10; if (!yy_end_of_line(ctx)) goto l9;
|
|
}
|
|
l10:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "space", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l9:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "space", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_braces(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "braces"));
|
|
{ int yypos14= ctx->pos, yythunkpos14= ctx->thunkpos; if (!yymatchChar(ctx, '{')) goto l15;
|
|
l16:;
|
|
{ int yypos17= ctx->pos, yythunkpos17= ctx->thunkpos; if (!yy_braces(ctx)) goto l17; goto l16;
|
|
l17:; ctx->pos= yypos17; ctx->thunkpos= yythunkpos17;
|
|
} if (!yymatchChar(ctx, '}')) goto l15; goto l14;
|
|
l15:; ctx->pos= yypos14; ctx->thunkpos= yythunkpos14;
|
|
{ int yypos18= ctx->pos, yythunkpos18= ctx->thunkpos; if (!yymatchChar(ctx, '}')) goto l18; goto l13;
|
|
l18:; ctx->pos= yypos18; ctx->thunkpos= yythunkpos18;
|
|
} if (!yymatchDot(ctx)) goto l13;
|
|
}
|
|
l14:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "braces", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l13:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "braces", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_range(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "range"));
|
|
{ int yypos20= ctx->pos, yythunkpos20= ctx->thunkpos; if (!yy_char(ctx)) goto l21; if (!yymatchChar(ctx, '-')) goto l21; if (!yy_char(ctx)) goto l21; goto l20;
|
|
l21:; ctx->pos= yypos20; ctx->thunkpos= yythunkpos20; if (!yy_char(ctx)) goto l19;
|
|
}
|
|
l20:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "range", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l19:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "range", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_char(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "char"));
|
|
{ int yypos23= ctx->pos, yythunkpos23= ctx->thunkpos; if (!yymatchChar(ctx, '\\')) goto l24; if (!yymatchClass(ctx, (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:; ctx->pos= yypos23; ctx->thunkpos= yythunkpos23; if (!yymatchChar(ctx, '\\')) goto l25; if (!yymatchClass(ctx, (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 l25; if (!yymatchClass(ctx, (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 l25; if (!yymatchClass(ctx, (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 l25; goto l23;
|
|
l25:; ctx->pos= yypos23; ctx->thunkpos= yythunkpos23; if (!yymatchChar(ctx, '\\')) goto l26; if (!yymatchClass(ctx, (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;
|
|
{ int yypos27= ctx->pos, yythunkpos27= ctx->thunkpos; if (!yymatchClass(ctx, (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 l28;
|
|
l27:; ctx->pos= yypos27; ctx->thunkpos= yythunkpos27;
|
|
}
|
|
l28:; goto l23;
|
|
l26:; ctx->pos= yypos23; ctx->thunkpos= yythunkpos23;
|
|
{ int yypos29= ctx->pos, yythunkpos29= ctx->thunkpos; if (!yymatchChar(ctx, '\\')) goto l29; goto l22;
|
|
l29:; ctx->pos= yypos29; ctx->thunkpos= yythunkpos29;
|
|
} if (!yymatchDot(ctx)) goto l22;
|
|
}
|
|
l23:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "char", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l22:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "char", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_END(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "END")); if (!yymatchChar(ctx, '>')) goto l30; if (!yy__(ctx)) goto l30;
|
|
yyprintf((stderr, " ok %s @ %s\n", "END", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l30:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "END", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_BEGIN(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "BEGIN")); if (!yymatchChar(ctx, '<')) goto l31; if (!yy__(ctx)) goto l31;
|
|
yyprintf((stderr, " ok %s @ %s\n", "BEGIN", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l31:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "BEGIN", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_DOT(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "DOT")); if (!yymatchChar(ctx, '.')) goto l32; if (!yy__(ctx)) goto l32;
|
|
yyprintf((stderr, " ok %s @ %s\n", "DOT", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l32:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "DOT", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_class(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "class")); if (!yymatchChar(ctx, '[')) goto l33; yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l33;
|
|
l34:;
|
|
{ int yypos35= ctx->pos, yythunkpos35= ctx->thunkpos;
|
|
{ int yypos36= ctx->pos, yythunkpos36= ctx->thunkpos; if (!yymatchChar(ctx, ']')) goto l36; goto l35;
|
|
l36:; ctx->pos= yypos36; ctx->thunkpos= yythunkpos36;
|
|
} if (!yy_range(ctx)) goto l35; goto l34;
|
|
l35:; ctx->pos= yypos35; ctx->thunkpos= yythunkpos35;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l33; if (!yymatchChar(ctx, ']')) goto l33; if (!yy__(ctx)) goto l33;
|
|
yyprintf((stderr, " ok %s @ %s\n", "class", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l33:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "class", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_literal(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "literal"));
|
|
{ int yypos38= ctx->pos, yythunkpos38= ctx->thunkpos; if (!yymatchClass(ctx, (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 l39; yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l39;
|
|
l40:;
|
|
{ int yypos41= ctx->pos, yythunkpos41= ctx->thunkpos;
|
|
{ int yypos42= ctx->pos, yythunkpos42= ctx->thunkpos; if (!yymatchClass(ctx, (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 l42; goto l41;
|
|
l42:; ctx->pos= yypos42; ctx->thunkpos= yythunkpos42;
|
|
} if (!yy_char(ctx)) goto l41; goto l40;
|
|
l41:; ctx->pos= yypos41; ctx->thunkpos= yythunkpos41;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l39; if (!yymatchClass(ctx, (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 l39; if (!yy__(ctx)) goto l39; goto l38;
|
|
l39:; ctx->pos= yypos38; ctx->thunkpos= yythunkpos38; if (!yymatchClass(ctx, (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 l37; yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l37;
|
|
l43:;
|
|
{ int yypos44= ctx->pos, yythunkpos44= ctx->thunkpos;
|
|
{ int yypos45= ctx->pos, yythunkpos45= ctx->thunkpos; if (!yymatchClass(ctx, (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 l45; goto l44;
|
|
l45:; ctx->pos= yypos45; ctx->thunkpos= yythunkpos45;
|
|
} if (!yy_char(ctx)) goto l44; goto l43;
|
|
l44:; ctx->pos= yypos44; ctx->thunkpos= yythunkpos44;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l37; if (!yymatchClass(ctx, (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 l37; if (!yy__(ctx)) goto l37;
|
|
}
|
|
l38:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "literal", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l37:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "literal", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_CLOSE(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(ctx, ')')) goto l46; if (!yy__(ctx)) goto l46;
|
|
yyprintf((stderr, " ok %s @ %s\n", "CLOSE", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l46:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "CLOSE", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_OPEN(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar(ctx, '(')) goto l47; if (!yy__(ctx)) goto l47;
|
|
yyprintf((stderr, " ok %s @ %s\n", "OPEN", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l47:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "OPEN", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_COLON(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "COLON")); if (!yymatchChar(ctx, ':')) goto l48; if (!yy__(ctx)) goto l48;
|
|
yyprintf((stderr, " ok %s @ %s\n", "COLON", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l48:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "COLON", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_PLUS(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar(ctx, '+')) goto l49; if (!yy__(ctx)) goto l49;
|
|
yyprintf((stderr, " ok %s @ %s\n", "PLUS", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l49:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "PLUS", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_STAR(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "STAR")); if (!yymatchChar(ctx, '*')) goto l50; if (!yy__(ctx)) goto l50;
|
|
yyprintf((stderr, " ok %s @ %s\n", "STAR", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l50:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "STAR", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_QUESTION(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "QUESTION")); if (!yymatchChar(ctx, '?')) goto l51; if (!yy__(ctx)) goto l51;
|
|
yyprintf((stderr, " ok %s @ %s\n", "QUESTION", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l51:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "QUESTION", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_primary(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "primary"));
|
|
{ int yypos53= ctx->pos, yythunkpos53= ctx->thunkpos; if (!yy_identifier(ctx)) goto l54; yyDo(ctx, yy_1_primary, ctx->begin, ctx->end); if (!yy_COLON(ctx)) goto l54; if (!yy_identifier(ctx)) goto l54;
|
|
{ int yypos55= ctx->pos, yythunkpos55= ctx->thunkpos; if (!yy_EQUAL(ctx)) goto l55; goto l54;
|
|
l55:; ctx->pos= yypos55; ctx->thunkpos= yythunkpos55;
|
|
} yyDo(ctx, yy_2_primary, ctx->begin, ctx->end); goto l53;
|
|
l54:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_identifier(ctx)) goto l56;
|
|
{ int yypos57= ctx->pos, yythunkpos57= ctx->thunkpos; if (!yy_EQUAL(ctx)) goto l57; goto l56;
|
|
l57:; ctx->pos= yypos57; ctx->thunkpos= yythunkpos57;
|
|
} yyDo(ctx, yy_3_primary, ctx->begin, ctx->end); goto l53;
|
|
l56:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_OPEN(ctx)) goto l58; if (!yy_expression(ctx)) goto l58; if (!yy_CLOSE(ctx)) goto l58; goto l53;
|
|
l58:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_literal(ctx)) goto l59; yyDo(ctx, yy_4_primary, ctx->begin, ctx->end); goto l53;
|
|
l59:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_class(ctx)) goto l60; yyDo(ctx, yy_5_primary, ctx->begin, ctx->end); goto l53;
|
|
l60:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_DOT(ctx)) goto l61; yyDo(ctx, yy_6_primary, ctx->begin, ctx->end); goto l53;
|
|
l61:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_action(ctx)) goto l62; yyDo(ctx, yy_7_primary, ctx->begin, ctx->end); goto l53;
|
|
l62:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_BEGIN(ctx)) goto l63; yyDo(ctx, yy_8_primary, ctx->begin, ctx->end); goto l53;
|
|
l63:; ctx->pos= yypos53; ctx->thunkpos= yythunkpos53; if (!yy_END(ctx)) goto l52; yyDo(ctx, yy_9_primary, ctx->begin, ctx->end);
|
|
}
|
|
l53:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "primary", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l52:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "primary", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_NOT(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "NOT")); if (!yymatchChar(ctx, '!')) goto l64; if (!yy__(ctx)) goto l64;
|
|
yyprintf((stderr, " ok %s @ %s\n", "NOT", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l64:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "NOT", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_suffix(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "suffix")); if (!yy_primary(ctx)) goto l65;
|
|
{ int yypos66= ctx->pos, yythunkpos66= ctx->thunkpos;
|
|
{ int yypos68= ctx->pos, yythunkpos68= ctx->thunkpos; if (!yy_QUESTION(ctx)) goto l69; yyDo(ctx, yy_1_suffix, ctx->begin, ctx->end); goto l68;
|
|
l69:; ctx->pos= yypos68; ctx->thunkpos= yythunkpos68; if (!yy_STAR(ctx)) goto l70; yyDo(ctx, yy_2_suffix, ctx->begin, ctx->end); goto l68;
|
|
l70:; ctx->pos= yypos68; ctx->thunkpos= yythunkpos68; if (!yy_PLUS(ctx)) goto l66; yyDo(ctx, yy_3_suffix, ctx->begin, ctx->end);
|
|
}
|
|
l68:; goto l67;
|
|
l66:; ctx->pos= yypos66; ctx->thunkpos= yythunkpos66;
|
|
}
|
|
l67:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "suffix", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l65:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "suffix", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_action(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "action")); if (!yymatchChar(ctx, '{')) goto l71; yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l71;
|
|
l72:;
|
|
{ int yypos73= ctx->pos, yythunkpos73= ctx->thunkpos; if (!yy_braces(ctx)) goto l73; goto l72;
|
|
l73:; ctx->pos= yypos73; ctx->thunkpos= yythunkpos73;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l71; if (!yymatchChar(ctx, '}')) goto l71; if (!yy__(ctx)) goto l71;
|
|
yyprintf((stderr, " ok %s @ %s\n", "action", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l71:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "action", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_AND(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "AND")); if (!yymatchChar(ctx, '&')) goto l74; if (!yy__(ctx)) goto l74;
|
|
yyprintf((stderr, " ok %s @ %s\n", "AND", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l74:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "AND", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_prefix(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "prefix"));
|
|
{ int yypos76= ctx->pos, yythunkpos76= ctx->thunkpos; if (!yy_AND(ctx)) goto l77; if (!yy_action(ctx)) goto l77; yyDo(ctx, yy_1_prefix, ctx->begin, ctx->end); goto l76;
|
|
l77:; ctx->pos= yypos76; ctx->thunkpos= yythunkpos76; if (!yy_AND(ctx)) goto l78; if (!yy_suffix(ctx)) goto l78; yyDo(ctx, yy_2_prefix, ctx->begin, ctx->end); goto l76;
|
|
l78:; ctx->pos= yypos76; ctx->thunkpos= yythunkpos76; if (!yy_NOT(ctx)) goto l79; if (!yy_suffix(ctx)) goto l79; yyDo(ctx, yy_3_prefix, ctx->begin, ctx->end); goto l76;
|
|
l79:; ctx->pos= yypos76; ctx->thunkpos= yythunkpos76; if (!yy_suffix(ctx)) goto l75;
|
|
}
|
|
l76:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "prefix", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l75:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "prefix", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_BAR(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "BAR")); if (!yymatchChar(ctx, '|')) goto l80; if (!yy__(ctx)) goto l80;
|
|
yyprintf((stderr, " ok %s @ %s\n", "BAR", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l80:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "BAR", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_sequence(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "sequence")); if (!yy_prefix(ctx)) goto l81;
|
|
l82:;
|
|
{ int yypos83= ctx->pos, yythunkpos83= ctx->thunkpos; if (!yy_prefix(ctx)) goto l83; yyDo(ctx, yy_1_sequence, ctx->begin, ctx->end); goto l82;
|
|
l83:; ctx->pos= yypos83; ctx->thunkpos= yythunkpos83;
|
|
}
|
|
yyprintf((stderr, " ok %s @ %s\n", "sequence", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l81:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "sequence", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_SEMICOLON(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "SEMICOLON")); if (!yymatchChar(ctx, ';')) goto l84; if (!yy__(ctx)) goto l84;
|
|
yyprintf((stderr, " ok %s @ %s\n", "SEMICOLON", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l84:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "SEMICOLON", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_expression(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "expression")); if (!yy_sequence(ctx)) goto l85;
|
|
l86:;
|
|
{ int yypos87= ctx->pos, yythunkpos87= ctx->thunkpos; if (!yy_BAR(ctx)) goto l87; if (!yy_sequence(ctx)) goto l87; yyDo(ctx, yy_1_expression, ctx->begin, ctx->end); goto l86;
|
|
l87:; ctx->pos= yypos87; ctx->thunkpos= yythunkpos87;
|
|
}
|
|
yyprintf((stderr, " ok %s @ %s\n", "expression", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l85:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "expression", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_EQUAL(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "EQUAL")); if (!yymatchChar(ctx, '=')) goto l88; if (!yy__(ctx)) goto l88;
|
|
yyprintf((stderr, " ok %s @ %s\n", "EQUAL", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l88:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "EQUAL", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_identifier(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "identifier")); yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l89; if (!yymatchClass(ctx, (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 l89;
|
|
l90:;
|
|
{ int yypos91= ctx->pos, yythunkpos91= ctx->thunkpos; if (!yymatchClass(ctx, (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 l91; goto l90;
|
|
l91:; ctx->pos= yypos91; ctx->thunkpos= yythunkpos91;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l89; if (!yy__(ctx)) goto l89;
|
|
yyprintf((stderr, " ok %s @ %s\n", "identifier", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l89:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "identifier", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_RPERCENT(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "RPERCENT")); if (!yymatchString(ctx, "%}")) goto l92; if (!yy__(ctx)) goto l92;
|
|
yyprintf((stderr, " ok %s @ %s\n", "RPERCENT", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l92:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "RPERCENT", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_end_of_file(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "end_of_file"));
|
|
{ int yypos94= ctx->pos, yythunkpos94= ctx->thunkpos; if (!yymatchDot(ctx)) goto l94; goto l93;
|
|
l94:; ctx->pos= yypos94; ctx->thunkpos= yythunkpos94;
|
|
}
|
|
yyprintf((stderr, " ok %s @ %s\n", "end_of_file", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l93:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "end_of_file", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_trailer(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "trailer")); if (!yymatchString(ctx, "%%")) goto l95; yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l95;
|
|
l96:;
|
|
{ int yypos97= ctx->pos, yythunkpos97= ctx->thunkpos; if (!yymatchDot(ctx)) goto l97; goto l96;
|
|
l97:; ctx->pos= yypos97; ctx->thunkpos= yythunkpos97;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l95; yyDo(ctx, yy_1_trailer, ctx->begin, ctx->end);
|
|
yyprintf((stderr, " ok %s @ %s\n", "trailer", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l95:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "trailer", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_definition(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "definition")); if (!yy_identifier(ctx)) goto l98; yyDo(ctx, yy_1_definition, ctx->begin, ctx->end); if (!yy_EQUAL(ctx)) goto l98; if (!yy_expression(ctx)) goto l98; yyDo(ctx, yy_2_definition, ctx->begin, ctx->end);
|
|
{ int yypos99= ctx->pos, yythunkpos99= ctx->thunkpos; if (!yy_SEMICOLON(ctx)) goto l99; goto l100;
|
|
l99:; ctx->pos= yypos99; ctx->thunkpos= yythunkpos99;
|
|
}
|
|
l100:;
|
|
yyprintf((stderr, " ok %s @ %s\n", "definition", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l98:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "definition", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy_declaration(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "declaration")); if (!yymatchString(ctx, "%{")) goto l101; yyText(ctx, ctx->begin, ctx->end); if (!(YY_BEGIN)) goto l101;
|
|
l102:;
|
|
{ int yypos103= ctx->pos, yythunkpos103= ctx->thunkpos;
|
|
{ int yypos104= ctx->pos, yythunkpos104= ctx->thunkpos; if (!yymatchString(ctx, "%}")) goto l104; goto l103;
|
|
l104:; ctx->pos= yypos104; ctx->thunkpos= yythunkpos104;
|
|
} if (!yymatchDot(ctx)) goto l103; goto l102;
|
|
l103:; ctx->pos= yypos103; ctx->thunkpos= yythunkpos103;
|
|
} yyText(ctx, ctx->begin, ctx->end); if (!(YY_END)) goto l101; if (!yy_RPERCENT(ctx)) goto l101; yyDo(ctx, yy_1_declaration, ctx->begin, ctx->end);
|
|
yyprintf((stderr, " ok %s @ %s\n", "declaration", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l101:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "declaration", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
YY_RULE(int) yy__(yycontext *ctx)
|
|
{
|
|
yyprintf((stderr, "%s\n", "_"));
|
|
l106:;
|
|
{ int yypos107= ctx->pos, yythunkpos107= ctx->thunkpos;
|
|
{ int yypos108= ctx->pos, yythunkpos108= ctx->thunkpos; if (!yy_space(ctx)) goto l109; goto l108;
|
|
l109:; ctx->pos= yypos108; ctx->thunkpos= yythunkpos108; if (!yy_comment(ctx)) goto l107;
|
|
}
|
|
l108:; goto l106;
|
|
l107:; ctx->pos= yypos107; ctx->thunkpos= yythunkpos107;
|
|
}
|
|
yyprintf((stderr, " ok %s @ %s\n", "_", ctx->buf+ctx->pos));
|
|
return 1;
|
|
}
|
|
YY_RULE(int) yy_grammar(yycontext *ctx)
|
|
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
|
|
yyprintf((stderr, "%s\n", "grammar")); if (!yy__(ctx)) goto l110;
|
|
{ int yypos113= ctx->pos, yythunkpos113= ctx->thunkpos; if (!yy_declaration(ctx)) goto l114; goto l113;
|
|
l114:; ctx->pos= yypos113; ctx->thunkpos= yythunkpos113; if (!yy_definition(ctx)) goto l110;
|
|
}
|
|
l113:;
|
|
l111:;
|
|
{ int yypos112= ctx->pos, yythunkpos112= ctx->thunkpos;
|
|
{ int yypos115= ctx->pos, yythunkpos115= ctx->thunkpos; if (!yy_declaration(ctx)) goto l116; goto l115;
|
|
l116:; ctx->pos= yypos115; ctx->thunkpos= yythunkpos115; if (!yy_definition(ctx)) goto l112;
|
|
}
|
|
l115:; goto l111;
|
|
l112:; ctx->pos= yypos112; ctx->thunkpos= yythunkpos112;
|
|
}
|
|
{ int yypos117= ctx->pos, yythunkpos117= ctx->thunkpos; if (!yy_trailer(ctx)) goto l117; goto l118;
|
|
l117:; ctx->pos= yypos117; ctx->thunkpos= yythunkpos117;
|
|
}
|
|
l118:; if (!yy_end_of_file(ctx)) goto l110;
|
|
yyprintf((stderr, " ok %s @ %s\n", "grammar", ctx->buf+ctx->pos));
|
|
return 1;
|
|
l110:; ctx->pos= yypos0; ctx->thunkpos= yythunkpos0;
|
|
yyprintf((stderr, " fail %s @ %s\n", "grammar", ctx->buf+ctx->pos));
|
|
return 0;
|
|
}
|
|
|
|
#ifndef YY_PART
|
|
|
|
typedef int (*yyrule)(yycontext *ctx);
|
|
|
|
YY_PARSE(int) YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart)
|
|
{
|
|
int yyok;
|
|
if (!yyctx->buflen)
|
|
{
|
|
yyctx->buflen= 1024;
|
|
yyctx->buf= (char *)malloc(yyctx->buflen);
|
|
yyctx->textlen= 1024;
|
|
yyctx->text= (char *)malloc(yyctx->textlen);
|
|
yyctx->thunkslen= 32;
|
|
yyctx->thunks= (yythunk *)malloc(sizeof(yythunk) * yyctx->thunkslen);
|
|
yyctx->valslen= 32;
|
|
yyctx->vals= (YYSTYPE *)malloc(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);
|
|
}
|
|
|
|
#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;
|
|
}
|
|
|