Update the variant example.

* examples/variant.yy: Formatting changes.
	One stage build.
This commit is contained in:
Akim Demaille
2008-08-09 14:59:34 +02:00
parent e5eb92e794
commit 36db78a733
2 changed files with 10 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
2008-11-10 Akim Demaille <demaille@gostai.com>
Update the variant example.
* examples/variant.yy: Formatting changes.
One stage build.
2008-11-10 Akim Demaille <demaille@gostai.com> 2008-11-10 Akim Demaille <demaille@gostai.com>
Support constructor with an argument. Support constructor with an argument.

View File

@@ -90,18 +90,17 @@ yylex (yy::parser::semantic_type* yylval)
switch (stage) switch (stage)
{ {
case 0: case 0:
yylval->build<std::string> () = yylval->build (std::string ("I have three numbers for you."));
std::string ("I have three numbers for you.");
result = yy::parser::token::TEXT; result = yy::parser::token::TEXT;
break; break;
case 1: case 1:
case 2: case 2:
case 3: case 3:
yylval->build<int> () = stage; yylval->build (stage);
result = yy::parser::token::NUMBER; result = yy::parser::token::NUMBER;
break; break;
case 4: case 4:
yylval->build<std::string> () = std::string ("And that's all!"); yylval->build (std::string ("And that's all!"));
result = yy::parser::token::TEXT; result = yy::parser::token::TEXT;
break; break;
default: default:
@@ -126,7 +125,7 @@ main (int argc, char *argv[])
{ {
yy::parser p; yy::parser p;
p.set_debug_level (!!getenv ("YYDEBUG")); p.set_debug_level (!!getenv ("YYDEBUG"));
p.parse (); return p.parse();
} }
// Local Variables: // Local Variables: