tags:

views:

42

answers:

0

A very long subject for an annoying issue. I am trying to parse this:

$A['B', 3] for example so that I can invoke a java class with the 3 arguments, something in the lines of:

simpleTermTwoParams returns [IEvaluator e]:
 v1=VAR '[' '\'' s1=STR '\'' ','  i1=INTEGER ']' {$e = new VarEvaluator ($v1.text, $s1.text, Integer.parseInt($i1.text);}
 ;

ANTLR3 cannot parse this, (no viable alternative at character ''')

There are several issues I cannot work out for now:

a) '#' would work but not '\'' b) INTEGER being a DIGIT+, considered as recursive, ANTLR cannot parse this as well. c) Trying to parse VAR '[' STR INTEGER ']' works, but I want STR to be between quotes, and a comma between STR and INTEGER, no success...

Any idea?

Thank you very much