-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
label 'label' type mismatch with previous definition: TOKEN_LABEL!=RULE_LABEL #195
Comments
I believe that I did this on purpose as I generate globally visible classes On Mon, Mar 25, 2013 at 9:44 AM, yankee42 [email protected] wrote:
Dictation in use. Please excuse homophones, malapropisms, and nonsense. |
When the outer alts are labeled, the two labels from the example are created in different context classes with different accessors. There is no ambiguity in the grammar, actions, or generated code, so it seems this should be resolved for a future release. As a primary example, consider the following:
In this example, the generated I set the milestone to 4.x to indicate a future release that's TBD. |
Don't we create Label1Context that is globally visible? what that collide |
Hi Sam, Could you please check the same problem starts to occur again in 4.6? Because the same grammar works well in 4.5.3.
Thanks. |
@ferhaterata this is a correct behavior. See this issue for detail: #1409 |
@ferhaterata Can you provide a specific example of what fails? We have one unit test added in #1458 but it sounds like you may have found another scenario? |
Hi @sharwell In the following, I provided a Grammar that ANTLR generates recognizer in 4.5.1 and 4.5.3 but fails in 4.6.1. The labels 'left' and 'right' represent two different types. Sorry for preparing a verbose grammar.
It throws
In fact, this one works fine,
I assume the problem occurs once repetitions are allowed in labels. |
@ferhaterata Those are great examples. Can you open a new issue for this since it's a regression? |
Found out the problem: it's occures in case of left-recursion rule. Will try to fix it. |
Added new issue: #1543 |
I noticed that I can't write a rule like this:
It gives the following error:
It looks like this is because once label refers to a parser rule and once to a lexer rule. If I slightly change the rule:
Everything works fine.
Since the labels are contained in seperate rules I think they should not interfere with each other.
(Also on stackoverflow: http://stackoverflow.com/q/15481471)
The text was updated successfully, but these errors were encountered: