How is XText terminals match its previous terminal? [message #1697251] |
Tue, 02 June 2015 13:23  |
Eclipse User |
|
|
|
Hi I am a newbie to Xtext. I am wondering if there is a way in XText syntax that terminals matches its previous terminal.
The situation is that I have several terminals that are derived from a single terminal:
T1, T2, T3 and T4 always start at the beginning of the every line of my DSL. I would like T4 to have the same characteristics and derivation of its nearest previous T literal.
Is there a way I can do it? Does T4 need to be derived from T?
|
|
|
|
Re: How is XText terminals match its previous terminal? [message #1697362 is a reply to message #1697318] |
Wed, 03 June 2015 08:33   |
Eclipse User |
|
|
|
I was trying to figure out if XText (or XTend if possible) supports literals matching nearest previous occurance of literals within the same class. For example in this occasion, if T3 is the closest literal of T before T4, then T4 derives in a same way as T3.
Another example is shown below
//"Text1", "Text2", "Text3" are pre-set strings, followed by a collection of strings E1, E2 and E3. E1, E2 and E3 are derived from E
//e1, e2 and e3 are strings from E1, E2 and E3, respectively.
"Text1" e1 //E1 always comes and only comes after "Text1", e1 is from a collection (enumeration) of E1
"Another Text" e' // Can we set an event handler catching e1, so that e' becomes e1?
//"Another Text" can follow after "Text1" "Text2" and "Text3"
In the example I showed above, E' (where e' derives from) can be E1, E2 and E3 but only one at one point, depending on which occurred from E is closest before the E'.
[Updated on: Wed, 03 June 2015 08:36] by Moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25005 seconds