Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Match Until (not working)
Match Until (not working) [message #1701107] Thu, 09 July 2015 07:30 Go to next message
Eclipse UserFriend
i'm trying to build a rule to match anything between 2 keywords, but it's not working:

Note: 'note' -> 'end note';
Re: Match Until (not working) [message #1701111 is a reply to message #1701107] Thu, 09 July 2015 08:01 Go to previous messageGo to next message
Eclipse UserFriend
that should be a terminal rule ?!?

[Updated on: Thu, 09 July 2015 08:02] by Moderator

Re: Match Until (not working) [message #1701116 is a reply to message #1701111] Thu, 09 July 2015 09:02 Go to previous messageGo to next message
Eclipse UserFriend
The problem is that terminal rules don't have context, and I need to put other things in the Note rule. Like for example:
Note: 'note' ('as' name=ID) ?
-> /*anything here*/
'end note';

How can I transform this in a terminal rule?
Re: Match Until (not working) [message #1701117 is a reply to message #1701116] Thu, 09 July 2015 09:05 Go to previous messageGo to next message
Eclipse UserFriend
hi, no: in non terminal rules -> is a First Token Set (Syntactic) Predicate
Re: Match Until (not working) [message #1701119 is a reply to message #1701117] Thu, 09 July 2015 09:05 Go to previous messageGo to next message
Eclipse UserFriend
i cannot be converted
Re: Match Until (not working) [message #1701123 is a reply to message #1701119] Thu, 09 July 2015 09:12 Go to previous messageGo to next message
Eclipse UserFriend
So any ideas to match the text:
note as N1
text from note, any thing is valid...
end note

Taking in account the previous rules mentioned?
Re: Match Until (not working) [message #1701132 is a reply to message #1701123] Thu, 09 July 2015 09:30 Go to previous messageGo to next message
Eclipse UserFriend
what about whitelisting the allowed content?
Re: Match Until (not working) [message #1701172 is a reply to message #1701132] Thu, 09 July 2015 11:59 Go to previous messageGo to next message
Eclipse UserFriend
Any text should be valid here. I can't whitelist infinite possibilities!
It would be nice if rules like ('a'..'z') existed for non terminals.
Re: Match Until (not working) [message #1701174 is a reply to message #1701172] Thu, 09 July 2015 12:05 Go to previous messageGo to next message
Eclipse UserFriend
No i mean something like

Note: 'note' ('as' name=ID) ?
content=Content
'end' 'note';

Content: (ID | INT | "keyword" | "otherkeyword" | STRING | ANY_OTHER)+
Re: Match Until (not working) [message #1701179 is a reply to message #1701174] Thu, 09 July 2015 12:32 Go to previous message
Eclipse UserFriend
Really nice, it works.
Previous Topic:xText 2.9 Gradle build error
Next Topic:Embedding DSL in Java
Goto Forum:
  


Current Time: Mon Nov 03 16:40:07 EST 2025

Powered by FUDForum. Page generated in 0.04375 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top