예제 #1
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);
  }
 protected String constructEntryForToken(ATokenDef node) {
   String token = node.getId().getText();
   String entry = "\t" + token.toUpperCase() + " (" + idx + ",\"" + transform(token) + "\"),\n";
   return entry;
 }