mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
Sync.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#line 7188 "../../doc/bison.texinfo"
|
#line 7195 "../../doc/bison.texinfo"
|
||||||
%skeleton "lalr1.cc" /* -*- C++ -*- */
|
%skeleton "lalr1.cc" /* -*- C++ -*- */
|
||||||
%define "parser_class_name" "calcxx_parser"
|
%define "parser_class_name" "calcxx_parser"
|
||||||
%defines
|
%defines
|
||||||
@@ -6,39 +6,39 @@
|
|||||||
# include <string>
|
# include <string>
|
||||||
# include "calc++-driver.hh"
|
# include "calc++-driver.hh"
|
||||||
%}
|
%}
|
||||||
#line 7204 "../../doc/bison.texinfo"
|
#line 7211 "../../doc/bison.texinfo"
|
||||||
// The parsing context.
|
// The parsing context.
|
||||||
%parse-param { calcxx_driver& driver }
|
%parse-param { calcxx_driver& driver }
|
||||||
%lex-param { calcxx_driver& driver }
|
%lex-param { calcxx_driver& driver }
|
||||||
#line 7217 "../../doc/bison.texinfo"
|
#line 7224 "../../doc/bison.texinfo"
|
||||||
%locations
|
%locations
|
||||||
%initial-action
|
%initial-action
|
||||||
{
|
{
|
||||||
// Initialize the initial location.
|
// Initialize the initial location.
|
||||||
@$.begin.filename = @$.end.filename = &driver.file;
|
@$.begin.filename = @$.end.filename = &driver.file;
|
||||||
};
|
};
|
||||||
#line 7231 "../../doc/bison.texinfo"
|
#line 7238 "../../doc/bison.texinfo"
|
||||||
%debug
|
%debug
|
||||||
%error-verbose
|
%error-verbose
|
||||||
#line 7241 "../../doc/bison.texinfo"
|
#line 7248 "../../doc/bison.texinfo"
|
||||||
// Symbols.
|
// Symbols.
|
||||||
%union
|
%union
|
||||||
{
|
{
|
||||||
int ival;
|
int ival;
|
||||||
std::string *sval;
|
std::string *sval;
|
||||||
};
|
};
|
||||||
#line 7258 "../../doc/bison.texinfo"
|
#line 7265 "../../doc/bison.texinfo"
|
||||||
%token YYEOF 0 "end of file"
|
%token YYEOF 0 "end of file"
|
||||||
%token TOKEN_ASSIGN ":="
|
%token TOKEN_ASSIGN ":="
|
||||||
%token <sval> TOKEN_IDENTIFIER "identifier"
|
%token <sval> TOKEN_IDENTIFIER "identifier"
|
||||||
%token <ival> TOKEN_NUMBER "number"
|
%token <ival> TOKEN_NUMBER "number"
|
||||||
%type <ival> exp "expression"
|
%type <ival> exp "expression"
|
||||||
#line 7271 "../../doc/bison.texinfo"
|
#line 7278 "../../doc/bison.texinfo"
|
||||||
%printer { debug_stream () << *$$; } "identifier"
|
%printer { debug_stream () << *$$; } "identifier"
|
||||||
%destructor { delete $$; } "identifier"
|
%destructor { delete $$; } "identifier"
|
||||||
|
|
||||||
%printer { debug_stream () << $$; } "number" "expression"
|
%printer { debug_stream () << $$; } "number" "expression"
|
||||||
#line 7282 "../../doc/bison.texinfo"
|
#line 7289 "../../doc/bison.texinfo"
|
||||||
%%
|
%%
|
||||||
%start unit;
|
%start unit;
|
||||||
unit: assignments exp { driver.result = $2; };
|
unit: assignments exp { driver.result = $2; };
|
||||||
@@ -57,7 +57,7 @@ exp: exp '+' exp { $$ = $1 + $3; }
|
|||||||
| TOKEN_IDENTIFIER { $$ = driver.variables[*$1]; }
|
| TOKEN_IDENTIFIER { $$ = driver.variables[*$1]; }
|
||||||
| TOKEN_NUMBER { $$ = $1; };
|
| TOKEN_NUMBER { $$ = $1; };
|
||||||
%%
|
%%
|
||||||
#line 7308 "../../doc/bison.texinfo"
|
#line 7315 "../../doc/bison.texinfo"
|
||||||
void
|
void
|
||||||
yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l,
|
yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l,
|
||||||
const std::string& m)
|
const std::string& m)
|
||||||
|
|||||||
Reference in New Issue
Block a user