Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Trouble with parser rules without assignments [SOLVED](Noob, pilot error)
Trouble with parser rules without assignments [SOLVED] [message #1180595] Mon, 11 November 2013 03:37 Go to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
These ones work OK:

// zero argument instructions
Clr returns Clr:  {Clr} "clr" ;
Not returns Not: {Not} 'not';
Absa returns Absa: {Absa} 'absa';


However, these do not:

IsElse:  '@else' {IsElse};
IsEndif: '@endif' {IsEndif};


I don't notice any difference between that and this:

IsElse: {IsElse} '@else' ;
IsEndif: {IsEndif} '@endif' ;


And I don't have any explicit return types in my failing rules, but the same thing happened when I did try those.

IsElse and IsEndif are not showing up in my Ecore model and as a result they are not available anywhere else either.

I have to say that understanding parser rules is about the most difficult thing about Xtext!

[Updated on: Mon, 11 November 2013 14:40]

Report message to a moderator

Re: Trouble with parser rules without assignments [message #1180621 is a reply to message #1180595] Mon, 11 November 2013 04:02 Go to previous messageGo to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Here's the abstract rule "Macro" which contains the 2 rules listed above, and one rule with one assignment that works OK:

Macro:
	IsPinConnected | IsElse | IsEndif 
;
Re: Trouble with parser rules without assignments [message #1180837 is a reply to message #1180621] Mon, 11 November 2013 07:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
IsElse: {IsElse} '@else' ;
IsEndif: {IsEndif} '@endif' ;

works fine for me.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Trouble with parser rules without assignments [message #1181336 is a reply to message #1180837] Mon, 11 November 2013 14:39 Go to previous message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Hi Christian,

Thanks for your help once again. The problem I was having had nothing to do with the grammar (big suprise)! I had messed up some paths in my project and the generated files from Xtext were landing outside of my workspace. Cleared that up and it is looking OK now!

The big clue (other than your remarks) were some errors in some of the generated files. I looked in there and found some parser rules that I had tried (and then deleted) yesterday. So I knew that the generated output in my workspace wasn't getting updated properly. I also checked the dates of the various files and found that the generated files in the workspace hadn't been updated since some time yesterday.

GW
Previous Topic:Cross Reference within Quotation Marks
Next Topic:Conflict between xtend and xtext language, model inferrer and dependencies?
Goto Forum:
  


Current Time: Fri Mar 29 13:50:53 GMT 2024

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

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

Back to the top