@yar3333, I'm running some tests here with @marcospassos and sometimes some of the issues we find are not straight forward, so I'll send you them so you can take a look. Since you are familiar with the code, there is a chance you recognize the error faster than us. Meanwhile, we will keep investigating, and Marcos will provide PRs with the fixes we can do.
This one is related to the root context creation. In the example below, we have a simple expression that will never match.
Grammar
grammar DemoGrammar;
root: ({false}? 'foo') EOF ;
Test
$lexer = new DemoLexer(CharStreams::fromString('foo'));
$tokens = new CommonTokenStream($lexer);
$parser = new DemoParser($tokens);
$result = $parser->root();
This one is related to the root context creation. In the example below, we have a simple expression that will never match.
Grammar
Test
Result
Again, please let us know if we can do something to help :)