Skip to main content



      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 11:00 Go to next message
Eclipse UserFriend
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 02:21 Go to previous messageGo to next message
Eclipse UserFriend
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 12:55 Go to previous messageGo to next message
Eclipse UserFriend
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 13:17 Go to previous messageGo to next message
Eclipse UserFriend
where is your terminal rule?

[Updated on: Tue, 15 January 2019 13:21] by Moderator

Re: how can i create a rule containing regular expression? [message #1801244 is a reply to message #1801243] Tue, 15 January 2019 13:20 Go to previous messageGo to next message
Eclipse UserFriend
what do you mean by -----?

[Updated on: Tue, 15 January 2019 13:20] by Moderator

Re: how can i create a rule containing regular expression? [message #1801245 is a reply to message #1801244] Tue, 15 January 2019 13:21 Go to previous messageGo to next message
Eclipse UserFriend
where is your terminal rule?
Re: how can i create a rule containing regular expression? [message #1801246 is a reply to message #1801245] Tue, 15 January 2019 13:35 Go to previous messageGo to next message
Eclipse UserFriend
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 13:43 Go to previous message
Eclipse UserFriend
-> is in terminal . In parse rules it is a predicate
Previous Topic:How to represent triple double quote string
Next Topic:Xtext 2.17.0.M1 is out
Goto Forum:
  


Current Time: Sat Jun 21 08:02:33 EDT 2025

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

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

Back to the top