Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to access grammar keywords in formatter
How to access grammar keywords in formatter [message #1809196] Thu, 11 July 2019 09:15 Go to next message
Ramesh Javalagatti is currently offline Ramesh JavalagattiFriend
Messages: 16
Registered: November 2018
Junior Member
Hi,
I am writing custom formatter for xtext editor in that i want to add new line separator before every keyword of grammar. So can any one please suggest me how can i do this.
Re: How to access grammar keywords in formatter [message #1809197 is a reply to message #1809196] Thu, 11 July 2019 09:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13163
Registered: July 2009
Senior Member
you can inject YourdslGrammarAccess (and use org.eclipse.xtext.GrammarUtil.getAllKeywords(Grammar))

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 11 July 2019 09:25]

Report message to a moderator

Re: How to access grammar keywords in formatter [message #1809210 is a reply to message #1809197] Thu, 11 July 2019 16:23 Go to previous message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 66
Registered: February 2016
Member
The Statemachine example shipped with Xtext covers such cases:
https://github.com/eclipse/xtext-eclipse/blob/master/org.eclipse.xtext.xtext.ui.examples/projects/fowlerdsl/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/formatting2/StatemachineFormatter.xtend
Previous Topic:Performance problem in xtext editor
Next Topic:Formatting Generated Code
Goto Forum:
  


Current Time: Sun Oct 20 19:38:53 GMT 2019

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

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

Back to the top