]> granicus.if.org Git - re2c/commitdiff
- Change original fprintf base -d patch by Derick to use YYDEBUG() lines
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Fri, 22 Apr 2005 22:15:55 +0000 (22:15 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Fri, 22 Apr 2005 22:15:55 +0000 (22:15 +0000)
code.cc
re2c.1.in

diff --git a/code.cc b/code.cc
index 1d6072a2d3079e04d28c7a43d419f61a392ecf31..657c7b6657203b6dd2bf8146c82f85a28deace2b 100644 (file)
--- 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);
 }
index df27847ee54d4cd3dc02edea3719dc6b0bf5629c..f91bf7c9ea7a515aea067971e37c4bfc81f63c95 100644 (file)
--- 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