Internals: Add parser debug printer.
This commit is contained in:
parent
b469feb44b
commit
30482f3eea
|
|
@ -359,7 +359,8 @@ void V3ParseImp::lexToken() {
|
||||||
|| token == ySTATIC__LEX //
|
|| token == ySTATIC__LEX //
|
||||||
|| token == yVIRTUAL__LEX //
|
|| token == yVIRTUAL__LEX //
|
||||||
|| token == yWITH__LEX //
|
|| token == yWITH__LEX //
|
||||||
// Never put yID_* here; below symbol table resolution would break
|
// Never put yID_* here; below symbol table resolution would break;
|
||||||
|
// parser will change symbol table affecting how next ID maybe interpreted
|
||||||
) {
|
) {
|
||||||
if (debugFlex() >= 6) {
|
if (debugFlex() >= 6) {
|
||||||
cout << " lexToken: reading ahead to find possible strength" << endl;
|
cout << " lexToken: reading ahead to find possible strength" << endl;
|
||||||
|
|
@ -488,18 +489,26 @@ int V3ParseImp::lexToBison() {
|
||||||
|
|
||||||
// yylval.scp = NULL; // Symbol table not yet needed - no packages
|
// yylval.scp = NULL; // Symbol table not yet needed - no packages
|
||||||
if (debugFlex() >= 6 || debugBison() >= 6) { // --debugi-flex and --debugi-bison
|
if (debugFlex() >= 6 || debugBison() >= 6) { // --debugi-flex and --debugi-bison
|
||||||
cout << " {" << yylval.fl->filenameLetters() << yylval.fl->asciiLineCol()
|
cout << "lexToBison " << yylval << endl;
|
||||||
<< "} lexToBison TOKEN=" << yylval.token << " " << tokenName(yylval.token);
|
|
||||||
if (yylval.token == yaID__ETC //
|
|
||||||
|| yylval.token == yaID__LEX //
|
|
||||||
|| yylval.token == yaID__aPACKAGE || yylval.token == yaID__aTYPE) {
|
|
||||||
cout << " strp='" << *(yylval.strp) << "'";
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
}
|
}
|
||||||
return yylval.token;
|
return yylval.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// V3ParseBisonYYSType functions
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& os, const V3ParseBisonYYSType& rhs) {
|
||||||
|
os << "TOKEN=" << rhs.token << " " << V3ParseImp::tokenName(rhs.token);
|
||||||
|
os << " {" << rhs.fl->filenameLetters() << rhs.fl->asciiLineCol() << "}";
|
||||||
|
if (rhs.token == yaID__ETC //
|
||||||
|
|| rhs.token == yaID__LEX //
|
||||||
|
|| rhs.token == yaID__aPACKAGE //
|
||||||
|
|| rhs.token == yaID__aTYPE) {
|
||||||
|
os << " strp='" << *(rhs.strp) << "'";
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// V3Parse functions
|
// V3Parse functions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ struct V3ParseBisonYYSType {
|
||||||
AstVarRef* varrefp;
|
AstVarRef* varrefp;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
std::ostream& operator<<(std::ostream& os, const V3ParseBisonYYSType& rhs);
|
||||||
|
|
||||||
#define YYSTYPE V3ParseBisonYYSType
|
#define YYSTYPE V3ParseBisonYYSType
|
||||||
|
|
||||||
|
|
@ -189,6 +190,7 @@ public:
|
||||||
|
|
||||||
// TODO: Many of these functions are the old interface; they'd be better as non-static
|
// TODO: Many of these functions are the old interface; they'd be better as non-static
|
||||||
// and called as READP->newString(...) etc.
|
// and called as READP->newString(...) etc.
|
||||||
|
// These can be called by either parser or lexer, as not lex/parser-position aware
|
||||||
string* newString(const string& text) {
|
string* newString(const string& text) {
|
||||||
// Allocate a string, remembering it so we can reclaim storage at lex end
|
// Allocate a string, remembering it so we can reclaim storage at lex end
|
||||||
string* strp = new string(text);
|
string* strp = new string(text);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue