Changeset 13 in default for trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src
- Timestamp:
- 10/22/10 16:14:33 (14 years ago)
- Location:
- trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools
- Files:
-
- 2 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 -
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/visitor/EbnfVisitor.java
r12 r13 6 6 7 7 import de.ugoe.cs.swe.bnftools.ebnf.Atom; 8 import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry; 8 9 import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList; 10 import de.ugoe.cs.swe.bnftools.ebnf.DeltaEntry; 9 11 import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf; 10 12 import de.ugoe.cs.swe.bnftools.ebnf.ExtRule; … … 13 15 import de.ugoe.cs.swe.bnftools.ebnf.HookCombinator; 14 16 import de.ugoe.cs.swe.bnftools.ebnf.Import; 17 import de.ugoe.cs.swe.bnftools.ebnf.ImportSection; 18 import de.ugoe.cs.swe.bnftools.ebnf.MergeEntry; 15 19 import de.ugoe.cs.swe.bnftools.ebnf.MergeRule; 16 20 import de.ugoe.cs.swe.bnftools.ebnf.OptionalSequence; … … 74 78 if (node instanceof EtsiBnf) { 75 79 visitBefore((EtsiBnf) node); 80 } else if (node instanceof ImportSection) { 81 visitBefore((ImportSection) node); 82 } else if (node instanceof BnfEntry) { 83 visitBefore((BnfEntry) node); 84 } else if (node instanceof DeltaEntry) { 85 visitBefore((DeltaEntry) node); 86 } else if (node instanceof MergeEntry) { 87 visitBefore((MergeEntry) node); 76 88 } else if (node instanceof Atom) { 77 89 visitBefore((Atom) node); … … 115 127 if (node instanceof EtsiBnf) { 116 128 visitAfter((EtsiBnf) node); 129 } else if (node instanceof ImportSection) { 130 visitAfter((ImportSection) node); 131 } else if (node instanceof BnfEntry) { 132 visitAfter((BnfEntry) node); 133 } else if (node instanceof DeltaEntry) { 134 visitAfter((DeltaEntry) node); 135 } else if (node instanceof MergeEntry) { 136 visitAfter((MergeEntry) node); 117 137 } else if (node instanceof Atom) { 118 138 visitAfter((Atom) node); … … 158 178 } 159 179 180 protected void visitBefore(ImportSection node) { 181 } 182 183 protected void visitAfter(ImportSection node) { 184 } 185 186 protected void visitBefore(BnfEntry node) { 187 } 188 189 protected void visitAfter(BnfEntry node) { 190 } 191 192 protected void visitBefore(DeltaEntry node) { 193 } 194 195 protected void visitAfter(DeltaEntry node) { 196 } 197 198 protected void visitBefore(MergeEntry node) { 199 } 200 201 protected void visitAfter(MergeEntry node) { 202 } 203 160 204 protected void visitBefore(Atom node) { 161 205 }
Note: See TracChangeset
for help on using the changeset viewer.