diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-08 06:58:59 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-08 06:58:59 +0000 |
commit | 31799abcd4ac79483b88bb721fd2ef5da9cd41fb (patch) | |
tree | a3af126967efa71bb6c6a297c36cd7aad2918f82 /cpp/src | |
parent | workaround for nasty bison problem (diff) | |
download | ice-31799abcd4ac79483b88bb721fd2ef5da9cd41fb.tar.bz2 ice-31799abcd4ac79483b88bb721fd2ef5da9cd41fb.tar.xz ice-31799abcd4ac79483b88bb721fd2ef5da9cd41fb.zip |
workaround for nasty bison problem
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/Grammer.y | 2 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 26 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.l | 4 |
3 files changed, 15 insertions, 17 deletions
diff --git a/cpp/src/Slice/Grammer.y b/cpp/src/Slice/Grammer.y index 30520b322a4..90023395846 100644 --- a/cpp/src/Slice/Grammer.y +++ b/cpp/src/Slice/Grammer.y @@ -23,6 +23,8 @@ yyerror(const char* s) %} +%pure_parser + %token ICE_SCOPE_DELIMITOR %token ICE_MODULE %token ICE_LOCAL diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 6d246ab0fe5..856c60026b5 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -161,11 +161,9 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) : _scoped = cont->scoped(); } _scoped += "::" + _name; - if (_unit) - { - _unit->addContent(this); - _comment = _unit->currentComment(); - } + assert(_unit); + _unit->addContent(this); + _comment = _unit->currentComment(); } bool @@ -1137,13 +1135,6 @@ Slice::ClassDecl::ClassDecl(const ContainerPtr& container, const string& name, b // ClassDef // ---------------------------------------------------------------------- -void -Slice::ClassDef::destroy() -{ - _bases.clear(); - Container::destroy(); -} - OperationPtr Slice::ClassDef::createOperation(const string& name, const TypePtr& returnType, @@ -1901,7 +1892,7 @@ void Slice::Unit::error(const char* s) { cerr << _currentFile << ':' << _currentLine << ": " << s << endl; - yynerrs++; + _errors++; } void @@ -1999,6 +1990,7 @@ Slice::Unit::parse(FILE* file, bool debug) assert(!Slice::unit); Slice::unit = this; + _errors = 0; _currentComment = ""; _currentLine = 1; _currentIncludeLevel = 0; @@ -2010,9 +2002,13 @@ Slice::Unit::parse(FILE* file, bool debug) extern FILE* yyin; yyin = file; int status = yyparse(); - if (yynerrs) + if (_errors) { status = EXIT_FAILURE; + } + + if (status == EXIT_FAILURE) + { while (!_containerStack.empty()) { popContainer(); @@ -2031,8 +2027,8 @@ Slice::Unit::parse(FILE* file, bool debug) void Slice::Unit::destroy() { - _builtins.clear(); _contentMap.clear(); + _builtins.clear(); Container::destroy(); } diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l index 28ae3658b92..5956871df0e 100644 --- a/cpp/src/Slice/Scanner.l +++ b/cpp/src/Slice/Scanner.l @@ -207,7 +207,7 @@ L [a-zA-Z_] StringTokPtr ident = new StringTok; ident->v = s; - yylval = ident; + *yylvalp = ident; return ICE_IDENTIFIER; } @@ -222,7 +222,7 @@ L [a-zA-Z_] StringTokPtr ident = new StringTok; ident->v = s; ident->v.erase(ident->v.find_first_of(" \t\v\n\r\f(")); - yylval = ident; + *yylvalp = ident; return ICE_OP_IDENTIFIER; } |