From: helly Date: Sun, 9 Apr 2006 15:19:34 +0000 (+0000) Subject: - Fixed generation of YYDEBUG() when using -d switch. X-Git-Tag: 0.13.6~408 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12a3911e71c39708fd822446648de3d5f96aea91;p=re2c - Fixed generation of YYDEBUG() when using -d switch. --- diff --git a/CHANGELOG b/CHANGELOG index 672ee99a..c9d41ef4 100644 --- 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 3a994f7d..382c3897 100644 --- 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 0165b706..57215d2f 100644 --- 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) { } diff --git a/htdocs/index.html b/htdocs/index.html index c7a1784e..a6c57831 100755 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -96,6 +96,7 @@ provide re2c packages.

Changelog

????-??-??: 0.10.2