mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-09-18 06:17:07 +00:00
doc: fixes in the C++ part
Reported by Askar Safin. http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00018.html http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00019.html * doc/bison.texi (Split Symbols): Fix access to token types. yylval is a pointer, so use ->. Fix coding style issues: space before paren.
This commit is contained in:
@@ -15,6 +15,7 @@ Anthony Heading [email protected]
|
||||
Antonio Silva Correia [email protected]
|
||||
Arnold Robbins [email protected]
|
||||
Art Haas [email protected]
|
||||
Askar Safin [email protected]
|
||||
Baron Schwartz [email protected]
|
||||
Ben Pfaff [email protected]
|
||||
Benoit Perrot [email protected]
|
||||
|
||||
+14
-16
@@ -10901,12 +10901,12 @@ Regular union-based code in Lex scanner typically look like:
|
||||
|
||||
@example
|
||||
[0-9]+ @{
|
||||
yylval.ival = text_to_int (yytext);
|
||||
return yy::parser::INTEGER;
|
||||
yylval->ival = text_to_int (yytext);
|
||||
return yy::parser::token::INTEGER;
|
||||
@}
|
||||
[a-z]+ @{
|
||||
yylval.sval = new std::string (yytext);
|
||||
return yy::parser::IDENTIFIER;
|
||||
yylval->sval = new std::string (yytext);
|
||||
return yy::parser::token::IDENTIFIER;
|
||||
@}
|
||||
@end example
|
||||
|
||||
@@ -10915,12 +10915,12 @@ initialized. So the code would look like:
|
||||
|
||||
@example
|
||||
[0-9]+ @{
|
||||
yylval.build<int>() = text_to_int (yytext);
|
||||
return yy::parser::INTEGER;
|
||||
yylval->build<int> () = text_to_int (yytext);
|
||||
return yy::parser::token::INTEGER;
|
||||
@}
|
||||
[a-z]+ @{
|
||||
yylval.build<std::string> = yytext;
|
||||
return yy::parser::IDENTIFIER;
|
||||
yylval->build<std::string> () = yytext;
|
||||
return yy::parser::token::IDENTIFIER;
|
||||
@}
|
||||
@end example
|
||||
|
||||
@@ -10929,12 +10929,12 @@ or
|
||||
|
||||
@example
|
||||
[0-9]+ @{
|
||||
yylval.build(text_to_int (yytext));
|
||||
return yy::parser::INTEGER;
|
||||
yylval->build (text_to_int (yytext));
|
||||
return yy::parser::token::INTEGER;
|
||||
@}
|
||||
[a-z]+ @{
|
||||
yylval.build(yytext);
|
||||
return yy::parser::IDENTIFIER;
|
||||
yylval->build (yytext);
|
||||
return yy::parser::token::IDENTIFIER;
|
||||
@}
|
||||
@end example
|
||||
|
||||
@@ -10983,10 +10983,8 @@ For instance, given the following declarations:
|
||||
Bison generates the following functions:
|
||||
|
||||
@example
|
||||
symbol_type make_IDENTIFIER(const std::string& v,
|
||||
const location_type& l);
|
||||
symbol_type make_INTEGER(const int& v,
|
||||
const location_type& loc);
|
||||
symbol_type make_IDENTIFIER (const std::string& v, const location_type& loc);
|
||||
symbol_type make_INTEGER (const int& v, const location_type& loc);
|
||||
symbol_type make_COLON (const location_type& loc);
|
||||
@end example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user