Changeset 12 in default for trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/visitor
- Timestamp:
- 10/22/10 15:45:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/visitor/EbnfVisitor.java
r11 r12 1 1 package de.ugoe.cs.swe.bnftools.visitor; 2 2 3 import java.util.Stack; 4 3 5 import org.eclipse.emf.ecore.EObject; 4 5 import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Import;6 6 7 7 import de.ugoe.cs.swe.bnftools.ebnf.Atom; … … 12 12 import de.ugoe.cs.swe.bnftools.ebnf.GroupedSequence; 13 13 import de.ugoe.cs.swe.bnftools.ebnf.HookCombinator; 14 import de.ugoe.cs.swe.bnftools.ebnf.Import; 14 15 import de.ugoe.cs.swe.bnftools.ebnf.MergeRule; 15 16 import de.ugoe.cs.swe.bnftools.ebnf.OptionalSequence; … … 26 27 27 28 protected EObject rootNode = null; 28 29 protected Stack<Boolean> lastElementStack = new Stack<Boolean>(); 30 29 31 public EbnfVisitor() { 30 32 } … … 46 48 47 49 private void acceptInner(EObject node) { 50 Boolean lastElement = false; 51 if (node.eContents().size() == 0) 52 lastElement = true; 53 lastElementStack.push(lastElement); 48 54 for (int i=0; i < node.eContents().size(); i++) { 49 55 EObject currentNode = (EObject) node.eContents().get(i); 56 if (i == node.eContents().size()-1) { 57 lastElement = true; 58 lastElementStack.pop(); 59 lastElementStack.push(lastElement); 60 } 50 61 dispatcherBefore(currentNode); 51 62 acceptInner(currentNode); 52 63 dispatcherAfter(currentNode); 53 64 } 65 lastElementStack.pop(); 66 } 67 68 protected boolean isLastElement() { 69 return lastElementStack.peek(); 54 70 } 55 71
Note: See TracChangeset
for help on using the changeset viewer.