Changeset 13 in default
- Timestamp:
- 10/22/10 16:14:33 (14 years ago)
- Location:
- trunk
- Files:
-
- 6 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs/swe
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs/swe/bnftools
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs/swe/bnftools/ui
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs/swe/bnftools/ui/contentassist
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs/swe/bnftools/ui/contentassist/antlr
-
Property
svn:ignore
set to
*
*.*
-
Property
svn:ignore
set to
-
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 } -
trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/Ebnf.xtext
r5 r13 11 11 'grammar' name=ID 12 12 ( type='/bnf'? ';' 13 (import s+=Import)*14 ( rule+=Rule | sectionheader+=SectionHeading)+13 (importSection=ImportSection)? 14 (bnfEntry+=BnfEntry)+ 15 15 ) 16 16 | 17 17 ( type='/delta' ';' 18 (import s+=Import)*19 ( rule+=Rule | sectionheader+=SectionHeading | extRule+=ExtRule)*18 (importSection=ImportSection)? 19 (deltaEntry+=DeltaEntry)* 20 20 ) 21 21 | 22 22 ( type='/merge' ';' 23 (import s+=Import)*24 ( sectionheader+=SectionHeading | mergeRule+=MergeRule)*23 (importSection=ImportSection)? 24 (mergeEntry+=MergeEntry)* 25 25 ) 26 26 ; 27 27 28 ImportSection: 29 (imports+=Import)+ 30 ; 31 32 BnfEntry: 33 sectionheader=SectionHeading | rule=Rule 34 ; 35 36 DeltaEntry: 37 rule=Rule | sectionheader=SectionHeading | extRule=ExtRule 38 ; 39 40 MergeEntry: 41 sectionheader=SectionHeading | mergeRule=MergeRule 42 ; 28 43 29 44 SectionHeading:
Note: See TracChangeset
for help on using the changeset viewer.