Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to write xtext grammar for if statement(if statement grammar using xtext)
How to write xtext grammar for if statement [message #1732272] Sat, 14 May 2016 10:40 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member

I am new to xtext. Can anyone tell me how to build xtext grammar below if statement?

if ((b1135_law_cd_cat == 'CR' || b1135_law_cd_cat == 'MJ') && juv_test_flag == 1)
int a;

I tried the below grammar:

IfStatement: 'if' ((condition+=Condition)| ( '(' condition+=Condition ')' ));

but it is working for below example but not above.

if (b1135_law_cd_cat == 'CR' || b1135_law_cd_cat == 'MJ'

I know my grammar supports only if(condition) but not if((condition) && condition).

any suggestions?
Re: How to write xtext grammar for if statement [message #1732279 is a reply to message #1732272] Sat, 14 May 2016 13:36 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13465
Registered: July 2009
Senior Member
Hi have a Look At


Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:How to configure xtend-maven-plugin to target earlier Java versions
Next Topic:Xtext recursive statement
Goto Forum:

Current Time: Tue May 26 17:38:17 GMT 2020

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

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

Back to the top