Try the following
public void parse_X() :
{}
{
((
LOOKAHEAD(parse_AA())
parse_AA()
|
parse_AB()
))*
}
If that doesn't work, the problem is that there is something that follows an X that can start with an <A>
.
Edit.
Since that didn't work, try the following:
public void parse_X() :
{}
{
( LOOKAHEAD( <A> )
(
LOOKAHEAD(parse_AA())
parse_AA()
|
parse_AB()
)
)*
}
Note that all this will do is suppress the warning. You'll have to to decided how to best deal with the ambiguity in your grammar.