]> granicus.if.org Git - re2c/commitdiff
- Fixed generation of YYDEBUG() when using -d switch.
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sun, 9 Apr 2006 15:19:34 +0000 (15:19 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sun, 9 Apr 2006 15:19:34 +0000 (15:19 +0000)
CHANGELOG
code.cc
dfa.h
htdocs/index.html

index 672ee99a429c1b6def0dba0e7ae5a23dffb4eb44..c9d41ef41061fa6b8fe777c6cf4a35f924e52819 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
 Version 0.10.2 (????-??-??)
 ---------------------------
+- Fixed generation of YYDEBUG() when using -d switch.
 - Added /*!getstate:re2c */ which triggers generation of the YYGETSTATE() block.
 - Added configuration 'state:abort'.
 - Changed to not generate yyNext unless configuration 'state:nextlabel' is used.
diff --git a/code.cc b/code.cc
index 3a994f7dc8f84e65bfb172b80870f195610b007f..382c38975a331b0d3b0481629bd49d590ac86e1b 100644 (file)
--- a/code.cc
+++ b/code.cc
@@ -387,6 +387,10 @@ void Initial::emit(std::ostream &o, uint ind, bool &readCh) const
        {
                o << "\n";
        }
+       if (dFlag)
+       {
+               o << indent(ind) << "YYDEBUG(" << label << ", *YYCURSOR);\n";
+       }
        if (state->link)
        {
                need(o, ind, state->depth, readCh, setMarker);
@@ -885,7 +889,7 @@ void State::emit(std::ostream &o, uint ind, bool &readCh) const
        {
                o << "yy" << label << ":\n";
        }
-       if (dFlag)
+       if (dFlag && !action->isInitial())
        {
                o << indent(ind) << "YYDEBUG(" << label << ", *YYCURSOR);\n";
        }
diff --git a/dfa.h b/dfa.h
index 0165b706318ab2f0619bbd040ac58e3b431d58fd..57215d2f3170f363baa31810ec80c58113fe8470 100644 (file)
--- a/dfa.h
+++ b/dfa.h
@@ -30,6 +30,7 @@ public:
        virtual void emit(std::ostream&, uint, bool&) const = 0;
        virtual bool isRule() const;
        virtual bool isMatch() const;
+       virtual bool isInitial() const;
        virtual bool readAhead() const;
 
 #ifdef PEDANTIC
@@ -72,6 +73,7 @@ public:
 public:
        Initial(State*, uint, bool);
        void emit(std::ostream&, uint, bool&) const;
+       bool isInitial() const;
 };
 
 class Save: public Match
@@ -293,6 +295,11 @@ inline bool Action::isMatch() const
        return false;
 }
 
+inline bool Action::isInitial() const
+{
+       return false;
+}
+
 inline bool Action::readAhead() const
 {
        return !isMatch() || (state && state->next && state->next->action && !state->next->action->isRule());
@@ -312,6 +319,11 @@ inline Enter::Enter(State *s, uint l) : Action(s), label(l)
 inline Initial::Initial(State *s, uint l, bool b) : Enter(s, l), setMarker(b)
 { }
 
+inline bool Initial::isInitial() const
+{
+       return true;
+}
+
 inline Save::Save(State *s, uint i) : Match(s), selector(i)
 { }
 
index c7a1784e214b4a175c35bb2d756dd823c79267ad..a6c5783114fab3a63645d3c58719a1b823c8c778 100755 (executable)
@@ -96,6 +96,7 @@ provide re2c packages.</li>
 <h1>Changelog</h1>
 <h2>????-??-??: 0.10.2</h2>
 <ul>
+<li>Fixed generation of YYDEBUG() when using -d switch.</li>
 <li>Added /*!getstate:re2c */ which triggers generation of the YYGETSTATE() block.</li>
 <li>Added configuration 'state:abort'.</li>
 <li>Changed to not generate yyNext unless configuration 'state:nextlabel' is used.</li>