Open shaahmad opened 8 years ago
Yes, it's a very tricky issue to solve without embedded code (considering the '0' as a token breaks the lexer), but I guess you can also verify this rule in your listeners or visitors.
I'm not sure if $val
works in python or has another name, but if does you could try with:
if not $val.text == "0":
raise InputMismatchException(this);
Check #416.
@Camiloasc1 I think that your code need to change to like this:
purespecifier
:
Assign val = Octalliteral
{if not $val.text == '0':
raise InputMismatchException(this)}
;
`
@Hyunsu-Lee Seems good to me. Can you go ahead and create a PR with that? I've been traveling for a few days and have no access to a proper workstation.
Is this fixed? @Camiloasc1 @Hyunsu-Lee
Is this fixed? @Camiloasc1 @Hyunsu-Lee
I was using changed code separately. Today, I applied this change to the fork and made a pull request, but all checks failed. There seems to be an error in the CI Maven build.
I can check out the changes and help with the PR then
@Camiloasc1 As you know, ANTLR has targets for languages other than Java. I am using it in a Python script. But line 1093 i.e. the pure-specifier bit has a line of embedded Java:
{if($val.text.compareTo("0")!=0) throw new InputMismatchException(this, $val.text);}
This causes Python to not be able to interpret the ANTLR output, raising a Syntax Error.
It would be nice to either indicate this in the "Possible Issues" section or somehow work around this.