mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +00:00
Support parens in calc++.
* doc/bison.texinfo (Calc++ Scanner, Calc++ Parser): Support parens. * examples/calc++/test (run): Check the expected output. Adjust callers. Check parens too.
This commit is contained in:
@@ -8620,6 +8620,7 @@ exp: exp '+' exp @{ $$ = $1 + $3; @}
|
||||
| exp '-' exp @{ $$ = $1 - $3; @}
|
||||
| exp '*' exp @{ $$ = $1 * $3; @}
|
||||
| exp '/' exp @{ $$ = $1 / $3; @}
|
||||
| '(' exp ')' @{ $$ = $2; @}
|
||||
| "identifier" @{ $$ = driver.variables[*$1]; delete $1; @}
|
||||
| "number" @{ $$ = $1; @};
|
||||
%%
|
||||
@@ -8724,7 +8725,7 @@ It is convenient to use a typedef to shorten
|
||||
typedef yy::calcxx_parser::token token;
|
||||
%@}
|
||||
/* Convert ints to the actual type of tokens. */
|
||||
[-+*/] return yy::calcxx_parser::token_type (yytext[0]);
|
||||
[-+*/()] return yy::calcxx_parser::token_type (yytext[0]);
|
||||
":=" return token::ASSIGN;
|
||||
@{int@} @{
|
||||
errno = 0;
|
||||
|
||||
Reference in New Issue
Block a user