Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Define a grammar to force the user to add a new line for every new entry in DSL editor(Define a grammar to force the user to add a new line for every new entry in DSL editor)
Define a grammar to force the user to add a new line for every new entry in DSL editor [message #1814224] Fri, 06 September 2019 06:36 Go to next message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 50
Registered: August 2011
Member
Dear All,

I have an use case where i need to allow the user to enter an new line for every entry for some rule in editor.

For Ex:

If entries like A, B, C, D and these entries come from model, i need to allow user to define these entries in editor like

entries : A
B
C
D
How to implement this use case in grammar and also proposal provider

Thank you



Re: Define a grammar to force the user to add a new line for every new entry in DSL editor [message #1814372 is a reply to message #1814224] Tue, 10 September 2019 12:00 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Usually newlines are handled as hidden tokens and thus be ignored. Whitespace are handled with the WS terminal rule from common Terminals. You'd need to overwrite the WS rule and make a different rule for newlines to enforce newlines before a certain rule. Although I'd handle this not by grammar, but rather by validation. You could also access the node model to implement a validation rule and check for newlines. For content assist, customize the content assist provider. The created proposals contains the text to be inserted at a certain position. This could include newlines.
Previous Topic:From EMF model to DSL
Next Topic:Define a grammar to force the user to enter a new line for every new entry in DSl editor
Goto Forum:
  


Current Time: Thu Sep 19 22:07:23 GMT 2024

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

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

Back to the top