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:
Akim Demaille
2008-08-21 22:39:01 +02:00
parent c944f7f22d
commit 1a7a65f9d5
3 changed files with 38 additions and 10 deletions

View File

@@ -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;