Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » how can i create a rule containing regular expression?(how can i create a rule containing regular expression?)
how can i create a rule containing regular expression? [message #1801094] Sun, 13 January 2019 16:00 Go to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
how can i create a rule containing regular expression?
example :

start :
a = b;
cc =dd;
end:

i dont care about what is enclosed between start and end statement, i just need to skip anything enclosed between them without reporting errors.

how to write a rule fulfill this purpose?
Re: how can i create a rule containing regular expression? [message #1801112 is a reply to message #1801094] Mon, 14 January 2019 07:21 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Have a look how the multiline comment is specified in TERMINALS
Re: how can i create a rule containing regular expression? [message #1801242 is a reply to message #1801112] Tue, 15 January 2019 17:55 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
I have tried something like that but it does not work.

typeMain returns XTTypeMain:
m += 'typeis' -> 'endtype'
;

typeis
askdjhaskjdhkajs // I need no errors here
endtype

I found that is produce syntax errors everywhere.
Is there is something i am missing?
Is this requirement is feasible in XTEXT as its mandatory in my case?
Also i need object of XTTypeMain to be created
Thanks
Re: how can i create a rule containing regular expression? [message #1801243 is a reply to message #1801242] Tue, 15 January 2019 18:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
where is your terminal rule?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 15 January 2019 18:21]

Report message to a moderator

Re: how can i create a rule containing regular expression? [message #1801244 is a reply to message #1801243] Tue, 15 January 2019 18:20 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
what do you mean by -----?

[Updated on: Tue, 15 January 2019 18:20]

Report message to a moderator

Re: how can i create a rule containing regular expression? [message #1801245 is a reply to message #1801244] Tue, 15 January 2019 18:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
where is your terminal rule?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: how can i create a rule containing regular expression? [message #1801246 is a reply to message #1801245] Tue, 15 January 2019 18:35 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
terminal INTEGER :
DIGIT | DIGIT ('_'? DIGIT)+
;

terminal fragment DIGIT:
'0'..'9'
;

Those are the terminals i have in my grammar
Also i have this terminal for comments

terminal ML_COMMENT:
'/*' -> '*/'
;
Re: how can i create a rule containing regular expression? [message #1801247 is a reply to message #1801246] Tue, 15 January 2019 18:43 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
-> is in terminal . In parse rules it is a predicate

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How to represent triple double quote string
Next Topic:Xtext 2.17.0.M1 is out
Goto Forum:
  


Current Time: Fri Apr 19 01:59:27 GMT 2024

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

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

Back to the top