Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to resolve terminal conflict
How to resolve terminal conflict [message #1806143] Fri, 03 May 2019 14:39 Go to next message
Balz Guenat is currently offline Balz GuenatFriend
Messages: 23
Registered: January 2018
Junior Member
My DSL extends from Xbase, which uses the '|' token for named lambda parameters.

In my DSL, I want to parse input such as
|foo|   |123|anything could be here~

that is, table columns with more-or-less-arbitrary content, separated by bars '|' and terminated by a tilde '~'.

The terminal rule for this input currently looks like this:
terminal LINE:
  '|' !('|' | '~') (!'~')* '~';


This shadows the '|' terminal used in the aforementioned Xbase definition, which means that lambda parameters renaming doesn't work anymore.

Since such input doesn't appear in the same context as lambdas, I considered rewriting the terminal rule as a data type rule. Something like
Line:
  '|' LINE_CONTENT '~';
terminal LINE_CONTENT:
  !('|' | '~') (!'~')*;


The problem here of course is, that now LINE_CONTENT shadows basically everything! No good at all.

Is there a way to write my grammar so it parses both these inputs as well as the Xbase lambdas?
Re: How to resolve terminal conflict [message #1807088 is a reply to message #1806143] Wed, 22 May 2019 11:38 Go to previous messageGo to next message
Balz Guenat is currently offline Balz GuenatFriend
Messages: 23
Registered: January 2018
Junior Member
Bump for visibility, as I still haven't found a solution.
Re: How to resolve terminal conflict [message #1807099 is a reply to message #1807088] Wed, 22 May 2019 14:28 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
just my 5 cent: what about avoiding terminal and use:

Line:
'|' linecontent=(LINE_CONTENT?) '~';
LINE_CONTENT:
!('|' | '~') (!'~')*;
Previous Topic:How to Test custom validation with JUnit
Next Topic:Using Xtext Parser/Java Models in Server Side (Spring Boot) App
Goto Forum:
  


Current Time: Thu Apr 18 04:16:43 GMT 2024

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

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

Back to the top