Esempio n. 1
0
 public LexerNode clone() {
   LexerNode node = new LexerNode();
   node.finalTokenName = this.finalTokenName;
   for (Map.Entry<Rule, LexerNode> entry : this.actions.entrySet()) {
     node.actions.put(entry.getKey().clone(), entry.getValue().clone());
   }
   for (String ongoing : this.ongoingParsing) {
     node.ongoingParsing.add(ongoing);
   }
   return node;
 }
Esempio n. 2
0
 public void append(LexerNode node) throws Exception {
   for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
     if (action.getKey() instanceof RuleEpsilon) continue;
     action.getValue().append(node);
   }
   if (actions.containsKey(new RuleEpsilon())) {
     actions.remove(new RuleEpsilon());
     merge(node.clone());
   }
   if (actions.size() == 0 || finalTokenName != null) {
     finalTokenName = null;
     merge(node.clone());
   }
 }