Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext terminal rule(xtext terminal rule)
xtext terminal rule [message #1734196] Mon, 06 June 2016 06:42 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I want to write an xtext terminal rule for '&' which should have prefix and suffix.

Example: a&b

How to write terminal rule for it?
Re: xtext terminal rule [message #1734230 is a reply to message #1734196] Mon, 06 June 2016 12:48 Go to previous messageGo to next message
Thomas Fritsch is currently offline Thomas FritschFriend
Messages: 28
Registered: April 2013
Location: Germany
Junior Member
Did you read the Xtext Grammar documentation http://help.eclipse.org/mars/topic/org.eclipse.xtext.doc/contents/301_grammarlanguage.html?cp=85_2_0 already?
terminal XYZ:
  ('a'..'z'|'A'..'Z')+ '&' ('a'..'z'|'A'..'Z')+;

(assuming prefix and suffix can be any sequence of 1 or more letters)
Re: xtext terminal rule [message #1734256 is a reply to message #1734230] Mon, 06 June 2016 15:04 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I already tried it but it is failing if I use like

a=b&c or a=b &c or a = b & c
Re: xtext terminal rule [message #1734257 is a reply to message #1734256] Mon, 06 June 2016 15:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14654
Registered: July 2009
Senior Member
you dont allow spaces in your grammar? it it linebased? then you should consider rewriting the WS rule

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext terminal rule [message #1734259 is a reply to message #1734257] Mon, 06 June 2016 15:27 Go to previous message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

It is working.
Previous Topic:Xtext how to write grammar for custom hash comment
Next Topic:Xtext grammar for custom hash comment
Goto Forum:
  


Current Time: Thu Feb 29 23:14:40 GMT 2024

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

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

Back to the top