[type]
Parser

[grammar]
grammar T;

s
@init {
<BuildParseTrees()>
}
@after {
<ToStringTree("$ctx"):writeln()>
}
  : '${' v '}'
  ;

v : A #altA
  | B #altB
  ;

A : 'a' ;
B : 'b' ;

WHITESPACE : [ \n\t\r]+ -> channel(HIDDEN) ;

ERROR : . ;

[start]
s

[input]
${ ? a ?}

[output]
"""(s ${ (v ? a) ? })
"""

[errors]
line 1:3 extraneous input '?' expecting {'a', 'b'}
line 1:7 extraneous input '?' expecting '}'

[skip]
Cpp
Go
PHP

