* src/evtgbatest/evtgbaparse.yy, src/evtgbaparse/evtgbascan.ll,

src/evtgbaparse/parsedecl.hh, src/evtgbaparse/public.hh,
src/ltlparse/fmterror.cc, src/ltlparse/ltlparse.yy,
src/ltlparse/ltlscan.ll, src/ltlparse/parsedecl.hh,
src/ltlparse/public.hh, src/tgbaparse/parsedecl.hh,
src/tgbaparse/public.hh, src/tgbaparse/tgbaparse.yy,
src/tgbaparse/tgbascan.ll: Adjust for Bison 2.3.  Use %name-prefix
instead of the "#define yy ... " kludge.
This commit is contained in:
Alexandre Duret-Lutz 2006-08-01 16:35:06 +00:00
parent db98955e9d
commit c055212326
14 changed files with 86 additions and 70 deletions

View file

@ -25,6 +25,7 @@
#include "evtgba/symbol.hh"
%}
%name-prefix="evtgbayy"
%parse-param {spot::evtgba_parse_error_list &error_list}
%parse-param {spot::evtgba_explicit* &result}
%debug
@ -120,7 +121,8 @@ init_decl:
%%
void
yy::parser::error(const location_type& location, const std::string& message)
evtgbayy::parser::error(const location_type& location,
const std::string& message)
{
error_list.push_back(spot::evtgba_parse_error(location, message));
}
@ -135,7 +137,7 @@ namespace spot
if (evtgbayyopen(name))
{
error_list.push_back
(evtgba_parse_error(yy::location(),
(evtgba_parse_error(evtgbayy::location(),
std::string("Cannot open file ") + name));
return 0;
}

View file

@ -33,6 +33,7 @@
#define YY_NEVER_INTERACTIVE 1
typedef evtgbayy::parser::token token;
%}
eol \n|\r|\n\r|\r\n
@ -43,12 +44,12 @@ eol \n|\r|\n\r|\r\n
yylloc->step ();
%}
acc[ \t]*= return ACC_DEF;
init[ \t]*= return INIT_DEF;
acc[ \t]*= return token::ACC_DEF;
init[ \t]*= return token::INIT_DEF;
[a-zA-Z][a-zA-Z0-9_]* {
yylval->str = new std::string(yytext);
return IDENT;
return token::IDENT;
}
/* discard whitespace */
@ -66,13 +67,13 @@ init[ \t]*= return INIT_DEF;
<STATE_STRING>{
\" {
BEGIN(INITIAL);
return STRING;
return token::STRING;
}
\\["\\] yylval->str->append(1, yytext[1]);
[^"\\]+ yylval->str->append(yytext, yyleng);
<<EOF>> {
BEGIN(INITIAL);
return UNTERMINATED_STRING;
return token::UNTERMINATED_STRING;
}
}

View file

@ -27,7 +27,8 @@
#include "location.hh"
# define YY_DECL \
int evtgbayylex (yystype *yylval, yy::location *yylloc)
int evtgbayylex (evtgbayy::parser::semantic_type *yylval, \
evtgbayy::location *yylloc)
YY_DECL;
namespace spot
@ -37,17 +38,4 @@ namespace spot
}
// Gross kludge to compile yy::Parser in another namespace (tgbayy::)
// but still use yy::Location. The reason is that Bison's C++
// skeleton does not support anything close to %name-prefix at the
// moment. All parser are named yy::Parser which makes it somewhat
// difficult to define multiple parsers.
namespace evtgbayy
{
using namespace yy;
}
#define yy evtgbayy
#endif // SPOT_EVTGBAPARSE_PARSEDECL_HH

View file

@ -23,7 +23,7 @@
# define SPOT_EVTGBAPARSE_PUBLIC_HH
# include "evtgba/explicit.hh"
# include "ltlparse/location.hh"
# include "location.hh"
# include <string>
# include <list>
# include <utility>
@ -32,7 +32,7 @@
namespace spot
{
/// \brief A parse diagnostic with its location.
typedef std::pair<yy::location, std::string> evtgba_parse_error;
typedef std::pair<evtgbayy::location, std::string> evtgba_parse_error;
/// \brief A list of parser diagnostics, as filled by parse.
typedef std::list<evtgba_parse_error> evtgba_parse_error_list;