Exemple #1
0
  @Override
  public void outAStateList(AStateList node) {
    Set set = new TreeSet();
    AStateListTail[] stateListTails =
        (AStateListTail[]) node.getStateLists().toArray(new AStateListTail[0]);

    for (int i = stateListTails.length - 1; i >= 0; i--) {
      String str = stateListTails[i].getId().getText().toUpperCase();
      set.add(str);
    }

    set.add(node.getId().getText().toUpperCase());
    setOut(node, set);
  }
Exemple #2
0
  @Override
  public void outATokenDef(ATokenDef node) {
    Set set = (Set) getOut(node.getStateList());
    Object o1 = getOut(node.getRegExp());

    if ((set == null) || (set.size() == 0) || set.contains(stateName)) {
      // System.out.print("*");

      NFA n1 = (o1 instanceof NFA) ? (NFA) o1 : new NFA((CharSet) o1);
      String name = (String) ids.names.get(node);

      n1.states[n1.states.length - 1].accept = name;
      setOut(node, n1);
    } else {
      // System.out.print("-");
    }

    // free memory
    if (getOut(node.getStateList()) != null) setOut(node.getStateList(), null);
    if (getOut(node.getRegExp()) != null) setOut(node.getRegExp(), null);
  }