How to return an action value from a JavaScript callback in ANTLR?

25 views
Skip to first unread message

Sebastian Wain

unread,
May 28, 2015, 3:42:39 PM5/28/15
to antlr-di...@googlegroups.com
I asked this question on StackOverflow. It is clear how to return a value in an action rule in languages such as Java and C# but in JavaScript we need some kind of callback mechanism if the result value comes from a function callback.

What are the alternatives to solve this issue?

Thanks,
Sebastian

Eric Vergnaud

unread,
May 28, 2015, 8:01:03 PM5/28/15
to antlr-di...@googlegroups.com
Hi,

Comments from Pointy on StackOverflow say it all.
Asynchronous calls are not supported and we have no plans to implement them.
This would require changing the antlr grammar itself.
As a general rule (for all targets), code in action rules is supported but discouraged.
You should use a listener or visitor instead, which give you much more flexibility.

Eric
Reply all
Reply to author
Forward
0 new messages