void Input() :
{}
{
"a" BC() "c"
}

void BC() :
{}
{
"b" [ "c" ]
}


有两种输出可能,如果:


void BC() :
{}
{
"b"
[ LOOKAHEAD( { getToken(1).kind == C && getToken(2).kind != C } )
<C:"c">
]
}



if (next token is "c" and following token is not "c") {
choose the nested expansion (i.e., go into the [...] construct)
} else {
go beyond the [...] construct without entering it.
}


rewritten 则:


void BC() :
{}
{
"b"
[ LOOKAHEAD( "c", { getToken(2).kind != C } )
<C:"c">
]
}