Examples of Perl5Compiler


Examples of org.apache.oro.text.regex.Perl5Compiler

   * @throws IOException
   */
  private void process(Reader unbufferedReader) throws IOException {
    BufferedReader bufferedReader = new BufferedReader(unbufferedReader);

    Perl5Compiler compiler = new Perl5Compiler();
    Pattern regexpPattern = null;
    try {
      regexpPattern = compiler.compile(regexp);
    } catch (MalformedPatternException mpe) {
      throw new RuntimeException("Bad pattern: " + regexp);
    }

    Perl5Matcher eventMatcher = new Perl5Matcher();
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

    } catch (Exception e) {
      if (LOG.isErrorEnabled()) { LOG.error("getJSLinks", e); }
    }

    try {
      final PatternCompiler cp = new Perl5Compiler();
      final Pattern pattern = cp.compile(STRING_PATTERN,
          Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
              | Perl5Compiler.MULTILINE_MASK);
      final Pattern pattern1 = cp.compile(URI_PATTERN,
              Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK
                  | Perl5Compiler.MULTILINE_MASK);
      final PatternMatcher matcher = new Perl5Matcher();

      final PatternMatcher matcher1 = new Perl5Matcher();
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

     * @throws org.nanocontainer.aop.MalformedRegularExpressionException
     *          if the regular expression is
     *          invalid.
     */
    public NameMatchesComponentPointcut(String regex) throws MalformedRegularExpressionException {
        Perl5Compiler compiler = new Perl5Compiler();
        try {
            pattern = compiler.compile(regex);
        } catch (MalformedPatternException e) {
            throw new MalformedRegularExpressionException("malformed component name regular expression", e);
        }
    }
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

    Vector patterns;
    Vector ids;
    PatternMatcher matcher;
   
    public PropsMatcher(InputStream is) throws IOException {
        PatternCompiler compiler=new Perl5Compiler();
        matcher=new Perl5Matcher();

        // read in a properties file
        Vector v=readPropertiesVector(is);
       
        patterns=new Vector();
        ids=new Vector(v.size());

        // prepare separate vectors of compiled patterns
        // and mapped ids
        for(int i=0;i<v.size();i++) {
            String[] temp=(String[]) v.elementAt(i);

            // compile a pattern
            try {
                Pattern p=compiler.compile(temp[0]);
                patterns.addElement(p);
                // save the id
                ids.addElement(temp[1]);
            } catch (MalformedPatternException mpe) {
                // omit entry, give warning*
 
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

  private static List<Rule> readConfigurationFile(Reader reader)
    throws IOException, MalformedPatternException {

    BufferedReader in=new BufferedReader(reader);
    Perl5Compiler compiler=new Perl5Compiler();
    List<Rule> rules=new ArrayList<Rule>();
    String line;
      
    while((line=in.readLine())!=null) {
      if (line.length() == 0)
        continue;
      char first=line.charAt(0);
      boolean sign=false;
      switch (first) {
      case '+' :
        sign=true;
        break;
      case '-' :
        sign=false;
        break;
      case ' ' : case '\n' : case '#' :           // skip blank & comment lines
        continue;
      default :
        throw new IOException("Invalid first character: "+line);
      }

      String regex=line.substring(1);

      Rule rule=new Rule();
      rule.pattern=(Perl5Pattern) compiler.compile(regex);
      rule.sign=sign;
      rule.regex=regex;
      rules.add(rule);
    }
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

        }
        buff.append('$');

        Pattern result = null;
        try {
            Perl5Compiler compiler = new Perl5Compiler();
            result = compiler.compile(buff.toString());
        } catch (MalformedPatternException exception) {
            // coding error if this gets thrown here...
            throw new InvalidRegexpException(pattern);
        }
        return result;
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

    private String[] getStartCommand() throws Exception {
        ArrayList args = new ArrayList();

        if (_serverStart != null) {
            Perl5Compiler compiler = new Perl5Compiler();
            Pattern pattern = compiler.compile("'.*'|[^\\s]*");
            Perl5Matcher matcher = new Perl5Matcher();
            PatternMatcherInput input = new PatternMatcherInput(_serverStart);

            while (matcher.contains(input, pattern)) {
                String arg = matcher.getMatch().toString();
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

    private Map _escapedPatternStrings = new HashMap();

    protected Pattern compilePattern(String pattern)
    {
        if (_patternCompiler == null)
            _patternCompiler = new Perl5Compiler();

        try
        {
            return _patternCompiler.compile(pattern, Perl5Compiler.SINGLELINE_MASK | Perl5Compiler.READ_ONLY_MASK);
        }
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

    private TemplateTokenFactory _factory;

    public TemplateParser()
    {
        Perl5Compiler compiler = new Perl5Compiler();

        try
        {
            _simpleIdPattern = compiler.compile(SIMPLE_ID_PATTERN);
            _implicitIdPattern = compiler.compile(IMPLICIT_ID_PATTERN);
        }
        catch (MalformedPatternException ex)
        {
            throw new ApplicationRuntimeException(ex);
        }
View Full Code Here

Examples of org.apache.oro.text.regex.Perl5Compiler

        }

        // compile splitpattern
        Element splitElement = DomHelper.getChildElement(widgetElement, Constants.WD_NS, "split", true);
        String patternString = DomHelper.getAttribute(splitElement, "pattern");
        Perl5Compiler compiler = new Perl5Compiler();
        Pattern pattern = null;
        try {
            pattern = compiler.compile(patternString, Perl5Compiler.READ_ONLY_MASK);
        } catch (MalformedPatternException e) {
            throw new Exception("Invalid regular expression at " + DomHelper.getLocation(splitElement) + ": " + e.getMessage());
        }
        aggregateDefinition.setSplitPattern(pattern, patternString);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.