From: helly Date: Fri, 22 Apr 2005 22:15:55 +0000 (+0000) Subject: - Change original fprintf base -d patch by Derick to use YYDEBUG() lines X-Git-Tag: 0.13.6~647 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a429255fa0e0aae2f8fa974d423b43099da74c86;p=re2c - Change original fprintf base -d patch by Derick to use YYDEBUG() lines --- diff --git a/code.cc b/code.cc index 1d6072a2..657c7b66 100644 --- a/code.cc +++ b/code.cc @@ -566,7 +566,7 @@ void Go::genSwitch(std::ostream &o, State *from, State *next, bool &readCh) if (dFlag) { - o << "\tfprintf(stderr, \"[%c]\\n\", yych);\n"; + o << "\tYYDEBUG(-1, yych);\n"; } if (readCh) @@ -749,7 +749,7 @@ void State::emit(std::ostream &o, bool &readCh) } if (dFlag) { - o << "\nfprintf(stderr, \"<" << label << ">[%c]\\n\", *YYCURSOR);\n"; + o << "\n\tYYDEBUG(" << label << ", *YYCURSOR);\n"; } action->emit(o, readCh); } diff --git a/re2c.1.in b/re2c.1.in index df27847e..f91bf7c9 100644 --- a/re2c.1.in +++ b/re2c.1.in @@ -7,6 +7,9 @@ .ds rx regular expression .ds lx \fIl\fP-expression \"$Log$ +\"Revision 1.15 2005/04/22 22:15:52 helly +\"- Change original fprintf base -d patch by Derick to use YYDEBUG() lines +\" \"Revision 1.14 2005/04/22 22:03:08 helly \"- Added -d flag which outputs a debugable parser. \" @@ -162,7 +165,10 @@ few keywords (e.g. for most programming languages). \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. +parser issues and states. If you use this switch you need to deine a macro +\fCYYDEBUG\fP that is called like a function with two parameters. the first +parameter receives the state or -1 and the second parameter receives the input +at the current cursor. .TP \fB-h\fP \fB-?\fP