You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EMFText uses specific tokens over general tokens. This leads to failures, where EMFText chooses a RULE that matches at the beginning, but does not match in any way beyond that.
Here is an example of the problem:
ITERATOR_NAME is more specific than SIMPLE_NAME and is therefore preferred when applying rules. Lets consider the following of our DSL (that is OCL):
def: forAll = 0
Now, forAll is not understand as a SIMPLE_NAME, but as an ITERATOR_NAME. This causes the following RULE to bug, i.e. the rule is not applicable. But instead of looking for alternatives (e.g. SIMPLE_NAME is still applicable before EMFText could gracefully degrade), EMFText continues in a bad state.
But again, the rule is not applicable beyond the fact, that it begins with "iterate" (i.e. there are no parantheses and so on). EMFText then remains in a bad state, without trying to apply other rules that are matching.
The text was updated successfully, but these errors were encountered:
I'm sorry, but I don't think EMFText can easily support this. The reason is that EMFText uses ANTLR as underlying parser technology. Once ANTLR has split the input stream into tokens according to the token definitions, this assignment of characters from the input to tokens is final. There is no way to interpret characters as a different token later on even if this might be reasonable from a users point of view.
Can you explain why you're defining tokens for keywords? I'd expect that one would directly define the keywords in syntax rules or use enumeration attributes. Maybe we can find another solution if we know what is the exact goal you're targeting at.
I did not design the language definition. But I am able to refactor it. Just writing from my tablet.
The exact goal is (1) to use keywords in token definitions as the definition of IterateExpCS; and (2) to reuse those keywords as normal strings in other token definitions as of SimpleNameCS.
I will answer again when I am back at my computer.
Hello,
EMFText uses specific tokens over general tokens. This leads to failures, where EMFText chooses a RULE that matches at the beginning, but does not match in any way beyond that.
Here is an example of the problem:
We have two TOKENs:
ITERATOR_NAME is more specific than SIMPLE_NAME and is therefore preferred when applying rules. Lets consider the following of our DSL (that is OCL):
Now, forAll is not understand as a SIMPLE_NAME, but as an ITERATOR_NAME. This causes the following RULE to bug, i.e. the rule is not applicable. But instead of looking for alternatives (e.g. SIMPLE_NAME is still applicable before EMFText could gracefully degrade), EMFText continues in a bad state.
The fix is therefor, to use
as ITERATOR_NAME does not mean a keyword in OCL. The case gets more worse (as the first one was resolvable), when considering the second example:
This triggers the following rule:
As "iterate" is more specific than
But again, the rule is not applicable beyond the fact, that it begins with "iterate" (i.e. there are no parantheses and so on). EMFText then remains in a bad state, without trying to apply other rules that are matching.
The text was updated successfully, but these errors were encountered: