1 grammar t024finally; 2 3 options { 4 language=Python; 5 } 6 7 prog returns [events] 8 @init {events = []} 9 @after {events.append('after')} 10 : ID {raise RuntimeError} 11 ; 12 catch [RuntimeError] {events.append('catch')} 13 finally {events.append('finally')} 14 15 ID : ('a'..'z')+ 16 ; 17 18 WS : (' '|'\n'|'\r')+ {$channel=HIDDEN} 19 ; 20