Changeset 13 in default for trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui
- Timestamp:
- 10/22/10 16:14:33 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java
r12 r13 5 5 6 6 import de.ugoe.cs.swe.bnftools.ebnf.Atom; 7 import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry; 7 8 import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList; 9 import de.ugoe.cs.swe.bnftools.ebnf.DeltaEntry; 8 10 import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf; 9 11 import de.ugoe.cs.swe.bnftools.ebnf.ExtRule; … … 12 14 import de.ugoe.cs.swe.bnftools.ebnf.HookCombinator; 13 15 import de.ugoe.cs.swe.bnftools.ebnf.Import; 16 import de.ugoe.cs.swe.bnftools.ebnf.ImportSection; 17 import de.ugoe.cs.swe.bnftools.ebnf.MergeEntry; 14 18 import de.ugoe.cs.swe.bnftools.ebnf.MergeRule; 15 19 import de.ugoe.cs.swe.bnftools.ebnf.OptionalSequence; … … 28 32 private FormatterConfig config; 29 33 30 int ruleCounter = 0;31 32 34 public EbnfFormatterVisitor(EObject rootNode, FormatterConfig config) { 33 35 super(rootNode); … … 52 54 buf.append(node.getType()); 53 55 buf.append(";"); 54 buf.append("\n \n");56 buf.append("\n"); 55 57 } 56 58 … … 58 60 } 59 61 62 protected void visitBefore(ImportSection node) { 63 buf.append("\n"); 64 } 65 66 protected void visitAfter(ImportSection node) { 67 buf.append("\n"); 68 } 69 70 protected void visitBefore(BnfEntry node) { 71 } 72 73 protected void visitAfter(BnfEntry node) { 74 } 75 76 protected void visitBefore(DeltaEntry node) { 77 } 78 79 protected void visitAfter(DeltaEntry node) { 80 } 81 82 protected void visitBefore(MergeEntry node) { 83 } 84 85 protected void visitAfter(MergeEntry node) { 86 } 87 60 88 protected void visitBefore(Atom node) { 61 89 } … … 136 164 137 165 protected void visitBefore(Rule node) { 138 if (ruleCounter == 0)139 buf.append("\n");140 141 ruleCounter++;142 166 if (node.getRulenumber() > 0) 143 167 buf.append(node.getRulenumber() + ". "); … … 164 188 165 189 protected void visitBefore(SectionHeading node) { 190 if (!buf.substring(buf.length()-2).equals("\n\n")) 191 buf.append("\n"); 192 193 buf.append(node.getSectionHeader()); 166 194 } 167 195 168 196 protected void visitAfter(SectionHeading node) { 197 buf.append("\n"); 169 198 } 170 199
Note: See TracChangeset
for help on using the changeset viewer.