Skip to main content



      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 05:15 Go to next message
Eclipse UserFriend
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 05:24 Go to previous messageGo to next message
Eclipse UserFriend
you can inject YourdslGrammarAccess (and use org.eclipse.xtext.GrammarUtil.getAllKeywords(Grammar))

[Updated on: Thu, 11 July 2019 05:25] by Moderator

Re: How to access grammar keywords in formatter [message #1809210 is a reply to message #1809197] Thu, 11 July 2019 12:23 Go to previous message
Eclipse UserFriend
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: Mon Apr 28 19:32:28 EDT 2025

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

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

Back to the top