Version 0.9.7 (200?-??-??)
--------------------------
- Applied #1181535 storable state patch.
+- Added -d flag which outputs a debugable parser.
- Fixed bug #1187785 Re2c fails to generate valid code.
- Fixed bug #1187452 unused variable `yyaccept'.
}
}
+ if (dFlag)
+ {
+ o << "\tfprintf(stderr, \"[%c]\\n\", yych);\n";
+ }
+
if (readCh)
{
o << "\tswitch((yych = *YYCURSOR)) {\n";
{
o << "yy" << label << ":";
}
- /* o << "\nfprintf(stderr, \"<" << label << ">\");\n";*/
+ if (dFlag)
+ {
+ o << "\nfprintf(stderr, \"<" << label << ">[%c]\\n\", *YYCURSOR);\n";
+ }
action->emit(o, readCh);
}
extern char *outputFileName;
extern bool sFlag;
extern bool bFlag;
+extern bool dFlag;
extern bool bUsedYYAccept;
extern unsigned int oline;
extern uint maxFill;
char *outputFileName = 0;
bool sFlag = false;
bool bFlag = false;
+bool dFlag = false;
bool bUsedYYAccept = false;
unsigned int oline = 1;
uint maxFill = 1;
mbo_opt_struct('h', 0, "help"),
mbo_opt_struct('s', 0, "nested-ifs"),
mbo_opt_struct('f', 0, "storable-state"),
+ mbo_opt_struct('d', 0, "debug-output"),
mbo_opt_struct('o', 1, "output"),
mbo_opt_struct('v', 0, "version"),
mbo_opt_struct('V', 0, "vernum"),
static void usage()
{
- cerr << "usage: re2c [-esbvh] file\n"
+ cerr << "usage: re2c [-esbvhd] file\n"
"\n"
"-? -h --help Display this info.\n"
"\n"
"\n"
"-o --output=output Specify the output file instead of stdout\n"
"\n"
+ "-d --debug-output Creates a parser that dumps information during\n"
+ " about the current position and in which state the\n"
+ " parser is.\n"
+ "\n"
"-v --version Show version information.\n"
"-V --vernum Show version as one number.\n"
;
sFlag = true;
break;
+ case 'd':
+ dFlag = true;
+ break;
+
case 'f':
vFillIndexes = 0;
break;
.ds rx regular expression
.ds lx \fIl\fP-expression
\"$Log$
+\"Revision 1.14 2005/04/22 22:03:08 helly
+\"- Added -d flag which outputs a debugable parser.
+\"
\"Revision 1.13 2005/04/22 21:50:33 helly
\"- Update date
\"
re2c \- convert regular expressions to C/C++
.SH SYNOPSIS
-\*(re [\fB-efsbvh\fP] [\fB-o output\fP] file\fP
+\*(re [\fB-efsbvhd\fP] [\fB-o output\fP] file\fP
.SH DESCRIPTION
\*(re is a preprocessor that generates C-based recognizers from regular
code out of the compiler. Most useful for specifications with more than a
few keywords (e.g. for most programming languages).
.TP
+\fB-d\fP
+Creates a parser that dumps information about the current position and in
+which state the parser is while parsing the input. This is useful to debug
+parser issues and states.
+.TP
\fB-h\fP
\fB-?\fP
Invoke a short help.