Package dk.brics.automaton

Examples of dk.brics.automaton.RegExp


                                String url = ((StringConstant)expr.getArg(0)).value;
                                url_map.put(value, url);
                            }
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: void bind(java.lang.String,java.lang.String)>")) {
                                String name = getName(expr);
                                RegExp re = getRegExp(expr);
                                regexp_bind.put(name, re);
                            }
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: void bind(java.lang.String,java.net.URL)>")) {
                                String name = getName(expr);
                                URL url = getConstantURL(expr.getArg(1));
View Full Code Here


        }
    }

    private RegExp getRegExp(InvokeExpr expr) {
        if (expr.getArg(1) instanceof StringConstant) {
            return new RegExp(((StringConstant) expr.getArg(1)).value);
        } else {
            throw new InvalidRuntimeUseException("Non-constant regexp");
        }
    }
View Full Code Here

        String type = at.getType().trim();
        if (type.equals("Ldk/brics/string/annotation/Type;") && at.getNumElems() == 1) {
            // XXX why are we trimming the regexp here?? Although rare, it is perfectly sane for a string-type
            // to end with blanks. E.g @Type("Hello ") would become @Type("Hello").
          String pattern = ((AnnotationStringElem)at.getElemAt(0)).getValue().trim();
          Automaton a = (new RegExp(pattern)).toAutomaton(bindings);
          automatonDescriptionMap.put(a, pattern);
          return a;
        }
        if (type.equals("Ldk/brics/string/annotation/LoadType;") && at.getNumElems() == 1) {
          String path = ((AnnotationStringElem)at.getElemAt(0)).getValue().trim();
View Full Code Here

        }
    }

    RegExp getRegExp(InvokeExpr expr) {
        if (expr.getArg(1) instanceof StringConstant) {
            return new RegExp(((StringConstant) expr.getArg(1)).value);
        } else {
            throw new InvalidRuntimeUseException("Non-constant regexp");
        }
    }
View Full Code Here

     * @throws IllegalArgumentException If the regular expression is invalid.
     */
    public Xeger(String regex, Random random) {
        assert regex != null;
        assert random != null;
        this.automaton = new RegExp(regex).toAutomaton();
        this.random = random;
    }
View Full Code Here

 
  /**
   * Builds the transition table data.
   */
  public void build() {
    RegExp regexp = new RegExp(this.expression);
    Automaton automata = regexp.toAutomaton(true);
    numOfStates = automata.getNumberOfStates();
    //System.out.println("Number of states " + numOfStates);
   
    State[] states = new State[numOfStates];
    automata.getStates().toArray(states);
View Full Code Here

TOP

Related Classes of dk.brics.automaton.RegExp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.