|
Last change
on this file was
72,
checked in by hkaulbersch, 12 years ago
|
|
Automatic PDF Generation from .fo files now works
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * generated by Xtext |
|---|
| 3 | */
|
|---|
| 4 | package de.ugoe.cs.swe.bnftools.formatting
|
|---|
| 5 |
|
|---|
| 6 | import com.google.inject.Inject
|
|---|
| 7 | import de.ugoe.cs.swe.bnftools.services.EbnfGrammarAccess
|
|---|
| 8 | import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter
|
|---|
| 9 | import org.eclipse.xtext.formatting.impl.FormattingConfig
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 | /** |
|---|
| 13 | * This class contains custom formatting description. |
|---|
| 14 | * |
|---|
| 15 | * see : http://www.eclipse.org/Xtext/documentation.html#formatting |
|---|
| 16 | * on how and when to use it |
|---|
| 17 | * |
|---|
| 18 | * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example |
|---|
| 19 | */
|
|---|
| 20 | class EbnfFormatter extends AbstractDeclarativeFormatter {
|
|---|
| 21 |
|
|---|
| 22 | @Inject extension EbnfGrammarAccess
|
|---|
| 23 |
|
|---|
| 24 | override protected void configureFormatting(FormattingConfig c) {
|
|---|
| 25 |
|
|---|
| 26 | // They will add and preserve newlines around comments |
|---|
| 27 | c.setLinewrap(0, 1, 2).before(SL_COMMENTRule)
|
|---|
| 28 | c.setLinewrap(0, 1, 2).before(ML_COMMENTRule)
|
|---|
| 29 | c.setLinewrap(0, 1, 1).after(ML_COMMENTRule)
|
|---|
| 30 |
|
|---|
| 31 | var EbnfGrammarAccess f = getGrammarAccess as EbnfGrammarAccess;
|
|---|
| 32 | c.setLinewrap.before(f.ruleRule);
|
|---|
| 33 | c.setLinewrap.before(f.importRule);
|
|---|
| 34 | c.setNoSpace.after(f.ruleAccess.rulenumberINTTerminalRuleCall_0_0_0)
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
Note: See
TracBrowser
for help on using the repository browser.