antlr3
antlr3 copied to clipboard
JavaScript target is broken in the latest (v3.5) release
If you try to compile any grammar for tests directory, say t001lexer.g
lexer grammar t001lexer;
options {
language = JavaScript;
}
ZERO: '0';
you'll get a bunch of errors including:
error(24): template error: JavaScript.stg 27:6: required parameters (filterMode) must appear before optional parameters
Which is expected because of
lexer(grammar, name, tokens, scopes, rules, numRules, labelType="Token",
filterMode, superClass="org.antlr.runtime.Lexer") ::= <<
in JavaScript.stg
Reproducible in linux and windows using OpenJDK v 1.6.0_20
and JRE 1.7.0_21
correspondingly
The actual result: nothing is generated
The expected result: the .js
and .tokens
files to be generated
I've got same problem. Are there any solutions?
Is this just a simple matter of changing the order of the arguments? ie:
lexer(grammar, name, tokens, scopes, rules, numRules, filterMode, labelType="Token", superClass="org.antlr.runtime.Lexer") ::= <<
I don't know enough about named argument passing in Javascript to discuss this...
sounds like that's the problem. That could be just one of many as I've never used that target.
For now we have to use antlr-3.3 (where JavaScript target seems to be working). And in 3.3 JavaScript.stg looks no different from 3.5 version. So I guess that the problem is not in the stg template file itself.
Could you please fix JS target in 3.5? We are going to use it heavily in our business project
@vlkv The language targets for this project are typically updated by the individual maintainer of the particular target. I don't know who, if anyone, is currently working on or maintaining the JavaScript target.
As an aside, is there a JavaScript target for Version 4 ?
On Fri, Sep 27, 2013 at 8:19 AM, Sam Harwell [email protected]:
@vlkv https://github.com/vlkv The language targets for this project are typically updated by the individual maintainer of the particular target. I don't know who, if anyone, is currently working on or maintaining the JavaScript target.
— Reply to this email directly or view it on GitHubhttps://github.com/antlr/antlr3/issues/111#issuecomment-25241071 .
@whitten Not currently, and no one has currently volunteered to take on that task. Unlike ANTLR 3, targets for ANTLR 4 are completely independent projects developed, hosted, and maintained by the maintainer of that target.
Hey! I'm using Antlr 3.5 and even I am getting error for Javascript Target. Is there any solution for the problem?
3.4 also has this issue. 3.3 doesn't, but it is buggy, mixing C to JS by putting something like (const char*)
to the generated file :(
Hi,
You probably want to switch to 4.5.1 directly. I don’t expect anyone will look into this.
Eric
Le 7 juil. 2015 à 05:58, sorawee [email protected] a écrit :
3.4 also has this issue. 3.3 doesn't, but it is buggy, mixing C to JS by putting something like (const char*) to the generated file :(
— Reply to this email directly or view it on GitHub https://github.com/antlr/antlr3/issues/111#issuecomment-119008577.