mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
tests: style changes
* tests/c++.at: Formatting changes. Use 'using' to shorten the code.
This commit is contained in:
20
tests/c++.at
20
tests/c++.at
@@ -142,26 +142,27 @@ exp: "int" { $$.push_back ($1); }
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
using yy::parser;
|
||||||
// symbol_type: construction, accessor.
|
// symbol_type: construction, accessor.
|
||||||
{
|
{
|
||||||
yy::parser::symbol_type s = yy::parser::make_INT(12);
|
parser::symbol_type s = parser::make_INT(12);
|
||||||
std::cerr << s.value.as<int>() << '\n';
|
std::cerr << s.value.as<int>() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// stack_symbol_type: construction, accessor.
|
// stack_symbol_type: construction, accessor.
|
||||||
{
|
{
|
||||||
yy::parser::symbol_type s = yy::parser::make_INT(123);
|
parser::symbol_type s = parser::make_INT(123);
|
||||||
yy::parser::stack_symbol_type ss(1, s);
|
parser::stack_symbol_type ss(1, s);
|
||||||
std::cerr << ss.value.as<int>() << '\n';
|
std::cerr << ss.value.as<int>() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// pushing on the stack.
|
// pushing on the stack.
|
||||||
{
|
{
|
||||||
yy::parser::stack_type st;
|
parser::stack_type st;
|
||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
{
|
{
|
||||||
yy::parser::symbol_type s(yy::parser::make_INT(i));
|
parser::symbol_type s = parser::make_INT(123);
|
||||||
yy::parser::stack_symbol_type ss(1, s);
|
parser::stack_symbol_type ss(1, s);
|
||||||
st.push(ss);
|
st.push(ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,10 +320,9 @@ namespace yy
|
|||||||
*yylloc = location ();])[
|
*yylloc = location ();])[
|
||||||
return parser::token::END_OF_FILE;]])[
|
return parser::token::END_OF_FILE;]])[
|
||||||
|
|
||||||
case ',':
|
case ',':]AT_TOKEN_CTOR_IF([[
|
||||||
]AT_TOKEN_CTOR_IF([[
|
return parser::make_COMMA (]AT_LOCATION_IF([location ()])[);]],
|
||||||
return parser::make_COMMA (]AT_LOCATION_IF([location ()])[);]], [[
|
[AT_LOCATION_IF([
|
||||||
]AT_LOCATION_IF([
|
|
||||||
*yylloc = location ();])[
|
*yylloc = location ();])[
|
||||||
return parser::token::COMMA;]])[
|
return parser::token::COMMA;]])[
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user