Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Tweak InternalDSLParser in order to recover from Mismatched tokens
Tweak InternalDSLParser in order to recover from Mismatched tokens [message #1715700] Wed, 25 November 2015 10:35 Go to next message
Aleksandar Toshovski is currently offline Aleksandar ToshovskiFriend
Messages: 78
Registered: December 2011
Member
I have a poor designed dsl language and in some cases i cannot design the language in Xtext to 100%. We decided to make the language stricter, but the old files aren't. In some cases that breaks the editor... What I want to achieve is to recover the parser from such cases. Every command of my dsl begins on a new line, so I want to tell the parser to go to the next line an look the next command.

Are there some examples in the xtext framework or known projects, that have done that?

Example:
.type real bla ?_defined(U|bla)
F|round(bla+1)
.output U|bla

F|round() is a method
bla is a variable, which is wrong written (It should be U|bla), but the our existing interpreter accepts the variable.. These U| describe the context of the variable and they weren't mandatory in the past. The problem is, that our grammar fails and stops working. I want to recover the parser and tell the parser to begin on the new line.

My second idea is to tell the parser seeing bla, that is actually U|bla, then it should work. So is there a way to tweak the parser input?
Re: Tweak InternalDSLParser in order to recover from Mismatched tokens [message #1715792 is a reply to message #1715700] Thu, 26 November 2015 10:13 Go to previous message
Aleksandar Toshovski is currently offline Aleksandar ToshovskiFriend
Messages: 78
Registered: December 2011
Member
I made alot of tests and I can solve the problems in the editor, but the autocompletion doesn't work. As far as I understand the diagram from [1] the changes in the parser are only part of the solution, because it doesn't affect the Node and semantic model. Is that correct? I need also to make changes in the node model in order to fix this issue with the auto completion and content assist.

I see alot of questions about that in stackoverflow and here but unfortunately there are no general tips, what has to be done in order to fix such issues. Is that kind of change of the parser not recommended?



[1] http://www.euclideanspace.com/software/development/eclipse/xtext/grammar/customising/index.htm
Previous Topic:How to generate/serialize pretty printed HTML-output
Next Topic:Xcore model support with Xtext 2.9.0.rc2
Goto Forum:
  


Current Time: Tue Apr 23 11:57:42 GMT 2024

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

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

Back to the top