Skip to content

Commit

Permalink
recompile greg, -Dp yySet, -DP yyPush,yyPop, potion: -D?P
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Apr 15, 2013
1 parent f1c4833 commit f883935
Show file tree
Hide file tree
Showing 5 changed files with 628 additions and 638 deletions.
2 changes: 1 addition & 1 deletion front/p2.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ int main(int argc, char *argv[]) {
printf(" v verbose\n");
printf(" t trace\n");
printf(" p parse\n");
printf(" P verbose + parse\n");
printf(" P parse verbose\n");
printf(" J Jit\n");
printf(" G GC\n");
goto END;
Expand Down
15 changes: 14 additions & 1 deletion front/potion.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void potion_cmd_usage(Potion *P) {
" --check check the script syntax and exit\n"
" -h, --help show this helpful stuff\n"
#ifdef DEBUG
" -D[itpvGJ] debugging flags\n"
" -D[itPpvGJ?] debugging flags, try -D?\n"
#endif
" -v, --version show version\n"
"(default: %s)\n",
Expand Down Expand Up @@ -246,6 +246,17 @@ int main(int argc, char *argv[]) {
}
#ifdef DEBUG
if (argv[i][0] == '-' && argv[i][1] == 'D') {
if (strchr(&argv[i][2], '?')) {
printf("-D debugging flags:\n");
printf(" i inspect\n");
printf(" v verbose\n");
printf(" t trace\n");
printf(" p parse\n");
printf(" P parse verbose\n");
printf(" J Jit\n");
printf(" G GC\n");
goto END;
}
if (strchr(&argv[i][2], 'i'))
P->flags |= DEBUG_INSPECT;
if (strchr(&argv[i][2], 'v'))
Expand All @@ -256,6 +267,8 @@ int main(int argc, char *argv[]) {
}
if (strchr(&argv[i][2], 'p'))
P->flags |= DEBUG_PARSE;
if (strchr(&argv[i][2], 'p'))
P->flags |= DEBUG_PARSE_VERBOSE;
if (strchr(&argv[i][2], 'J'))
P->flags |= DEBUG_JIT;
if (strchr(&argv[i][2], 'G'))
Expand Down
15 changes: 11 additions & 4 deletions syn/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,9 @@ YY_LOCAL(void) yyDone(GREG *G)\n\
{\n\
yythunk *thunk= &G->thunks[pos];\n\
int yyleng= thunk->end ? yyText(G, thunk->begin, thunk->end) : thunk->begin;\n\
yyprintf((stderr, \"DO [%d] %s\", pos, thunk->name));\n\
yyprintfv((stderr, \"DO [%d] %s %d\", pos, thunk->name, thunk->begin));\n\
yyprintfvTcontext(G->text);\n\
yyprintf((stderr, \"\\n\"));\n\
yyprintfv((stderr, \"\\n\"));\n\
thunk->action(G, G->text, yyleng, thunk, G->data);\n\
}\n\
G->thunkpos= 0;\n\
Expand Down Expand Up @@ -761,6 +761,7 @@ YY_LOCAL(int) yyAccept(GREG *G, int tp0)\n\
}\n\
\n\
YY_LOCAL(void) yyPush(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR) {\n\
yyprintfv((stderr, \"yyPush %d\\n\", count));\n\
size_t off = (G->val - G->vals) + count;\n\
if (off > G->valslen) {\n\
while (G->valslen < off + 1)\n\
Expand All @@ -771,8 +772,14 @@ YY_LOCAL(void) yyPush(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE Y
G->val += count;\n\
}\n\
}\n\
YY_LOCAL(void) yyPop(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR) { G->val -= count; }\n\
YY_LOCAL(void) yySet(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR) { G->val[count]= G->ss; }\n\
YY_LOCAL(void) yyPop(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR) {\n\
yyprintfv((stderr, \"yyPop %d\\n\", count));\n\
G->val -= count;\n\
}\n\
YY_LOCAL(void) yySet(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY_XVAR) {\n\
yyprintf((stderr, \"yySet %d %p\\n\", count, (void*)yy));\n\
G->val[count]= yy;\n\
}\n\
\n\
#endif /* YY_PART */\n\
\n\
Expand Down
Loading

0 comments on commit f883935

Please sign in to comment.