I'm trying to have some bit of code running each time the parser recognises a token.
Let's say
grammar FooBar
rule start
(foo "\n")+
end
rule foo
stuff_i_want:([a-z]+) {
puts "Hi there I found: #{stuff_i_want.text_value}"
}
end
end
The idea here would be to have this puts
action execute each time the foo
token is found. Coded as is, it does not work as it is triggered only once (at the class loading time) and of course stuff_i_want.text_value
does not exist then.
Any idea? Is it even possible? The lack of documentation on the library does not make it easy to tell.