source: default/trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/formatting/EbnfFormatter.java @ 5

Last change on this file since 5 was 5, checked in by zeiss, 14 years ago
  • Property svn:mime-type set to text/plain
File size: 1.6 KB
Line 
1/*
2 * generated by Xtext
3 */
4package de.ugoe.cs.swe.bnftools.formatting;
5
6import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
7import org.eclipse.xtext.formatting.impl.FormattingConfig;
8
9/**
10 * This class contains custom formatting description.
11 *
12 * see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
13 * on how and when to use it
14 *
15 * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
16 */
17public class EbnfFormatter extends AbstractDeclarativeFormatter {
18       
19        @Override
20        protected void configureFormatting(FormattingConfig c) {
21                de.ugoe.cs.swe.bnftools.services.EbnfGrammarAccess f = (de.ugoe.cs.swe.bnftools.services.EbnfGrammarAccess) getGrammarAccess();
22
23                c.setIndentationSpace(" ");
24                c.setNoLinewrap();
25                c.setAutoLinewrap(10000000);
26                c.setLinewrap(2).before(f.getSectionHeadingRule());
27                c.setLinewrap(2).after(f.getSectionHeadingRule());
28               
29               
30                c.setNoSpace().after(f.getRuleAccess().getRulenumberINTTerminalRuleCall_0_0_0());
31                c.setNoSpace().after(f.getRuleAccess().getRulevariantIDTerminalRuleCall_0_1_0());
32
33                c.setLinewrap().before(f.getRuleAccess().getRulenumberINTTerminalRuleCall_0_0_0());
34                c.setNoSpace().before(f.getRuleAccess().getSemicolonKeyword_4());
35//              c.setNoSpace().before(f.getRuleAccess().getNameIDTerminalRuleCall_1_0());
36
37//              c.setLinewrap().after(f.getRuleAccess().getDefinitionListDefinitionListParserRuleCall_3_0());
38                c.setLinewrap().after(f.getRuleAccess().getDefinitionListAssignment_3());
39
40                c.setLinewrap(2).before(f.getSL_COMMENTRule());
41                c.setNoLinewrap().after(f.getSL_COMMENTRule());
42                c.setLinewrap(2).before(f.getML_COMMENTRule());
43        }
44       
45}
Note: See TracBrowser for help on using the repository browser.