Ejemplo n.º 1
0
    @Override
    public FSM parseToFSM() {

      boolean first = true;
      FSM tmp = null;

      boolean isSimple = true;

      for (Expression e : this.disj) {
        if (first) {
          tmp = e.parseToFSM();
          first = false;
          if (e.getType() != RegularExpressionParser.Literal) isSimple = false;
        } else if (e.getType() == RegularExpressionParser.Literal && isSimple) {

          IntDomain dom = tmp.initState.transitions.iterator().next().domain;
          int val = Integer.parseInt(((Literal) e).lit);

          tmp.initState.transitions.iterator().next().domain = dom.union(val);

        } else {
          tmp = tmp.union(e.parseToFSM());
          isSimple = false;
        }
      }
      return tmp;
    }