jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-oro/src/java/org/apache/oro/text/regex OpCode.java Perl5Compiler.java Perl5Matcher.java
Date Sun, 28 Jan 2001 22:21:57 GMT
dfs         01/01/28 14:21:57

  Modified:    src/java/org/apache/oro/text/regex OpCode.java
                        Perl5Compiler.java Perl5Matcher.java
  Log:
  Removed commented out code from Perl5Compiler and Perl5Matcher.
  Also changed OpCode._isWordCharacter to use Character.isLetterOrDigit().
  
  Revision  Changes    Path
  1.3       +3 -5      jakarta-oro/src/java/org/apache/oro/text/regex/OpCode.java
  
  Index: OpCode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/OpCode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OpCode.java	2000/07/23 23:25:24	1.2
  +++ OpCode.java	2001/01/28 22:21:57	1.3
  @@ -63,7 +63,7 @@
    * op-codes used in a compiled regular expression.
   
    @author <a href="mailto:dfs@savarese.org">Daniel F. Savarese</a>
  - @version $Id: OpCode.java,v 1.2 2000/07/23 23:25:24 jon Exp $
  + @version $Id: OpCode.java,v 1.3 2001/01/28 22:21:57 dfs Exp $
    */
   final class OpCode {
   
  @@ -178,10 +178,8 @@
   
     // doesn't really belong in this class, but we want Perl5Matcher not to
     // depend on Perl5Compiler
  +  // Matches Perl's definition of \w, which is different from [:alnum:]
     static final boolean _isWordCharacter(char token) {
  -    return ((token >= 'a' && token <= 'z') ||
  -            (token >= 'A' && token <= 'Z') ||
  -            (token >= '0' && token <= '9') ||
  -            (token == '_'));
  +    return (Character.isLetterOrDigit(token) || token == '_');
     }        
   }
  
  
  
  1.5       +3 -30     jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Compiler.java
  
  Index: Perl5Compiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Compiler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Perl5Compiler.java	2000/12/24 03:34:25	1.4
  +++ Perl5Compiler.java	2001/01/28 22:21:57	1.5
  @@ -65,7 +65,7 @@
    * information about Perl5 regular expressions.
   
    @author <a href="mailto:dfs@savarese.org">Daniel F. Savarese</a>
  - @version $Id: Perl5Compiler.java,v 1.4 2000/12/24 03:34:25 dfs Exp $
  + @version $Id: Perl5Compiler.java,v 1.5 2001/01/28 22:21:57 dfs Exp $
   
    * @see PatternCompiler
    * @see MalformedPatternException
  @@ -451,9 +451,6 @@
   	}
         }
   
  -      // System.err.println("next: " + ret + " last: " + __input._getValue()); // debug
  -
  -
         return ret;
       }
   
  @@ -1183,15 +1180,11 @@
   	   "NumberFormatException message: " + e.getMessage());
   	}
   
  -	//System.err.println("min: " + min + " max: " + max); //debug
  -
   	if(max == 0 && __input._getValue(pos) != '0')
   	  max = Character.MAX_VALUE;
   	__input._setOffset(next);
   	__getNextChar();
   
  -	//System.err.println("min: " + min + " max: " + max); //debug
  -
   	nestCheck = true;
   	handleRepetition = true;
         }
  @@ -1453,14 +1446,9 @@
       __program= null;
   
       __emitCode((char)0);
  -    if(__parseExpression(false, flags) == OpCode._NULL_OFFSET) {
  -      //System.err.println("null -- Size: " + __programSize); // debug
  -      // return null;
  +    if(__parseExpression(false, flags) == OpCode._NULL_OFFSET)
         throw new MalformedPatternException("Unknown compilation error.");
  -    }
   
  -    //System.err.println("First Pass Size: " + __programSize); //debug
  -
       if(__programSize >= Character.MAX_VALUE - 1)
         throw new MalformedPatternException("Expression is too large.");
   
  @@ -1478,13 +1466,8 @@
       __cost             = 0;
   
       __emitCode((char)0);
  -    if(__parseExpression(false, flags) == OpCode._NULL_OFFSET) {
  -      //System.err.println("null -- Size: " + __programSize); //debug 
  -      //return null;
  +    if(__parseExpression(false, flags) == OpCode._NULL_OFFSET)
         throw new MalformedPatternException("Unknown compilation error.");
  -    }
  -
  -    //System.err.println("Second Pass Size: " + __programSize); //debug
   
       caseInsensitive = __modifierFlags[0] & __CASE_INSENSITIVE;
   
  @@ -1559,16 +1542,6 @@
   
         if(sawPlus && (!sawOpen || !__sawBackreference))
   	regexp._anchor |= Perl5Pattern._OPT_SKIP;
  -
  -
  -      //length = OpCode._getNextOperator(first); //debug
  -      // System.err.println("first: " + first + "nextoper: " + length);
  -      //System.err.print("first " + (int)op + " next "); // debug
  -      //if(length >= 0 && length < _program.length) //debug
  -      //System.err.print((int)(__program[length])); //debug
  -      //else  //debug
  -      //System.err.print("out of range"); //debug
  -      //System.err.println(" offset " + (int)(first - scan)); // debug
   
         lastLongest   = new StringBuffer();
         longest   = new StringBuffer();
  
  
  
  1.7       +1 -21     jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Matcher.java
  
  Index: Perl5Matcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Matcher.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Perl5Matcher.java	2000/12/24 03:34:25	1.6
  +++ Perl5Matcher.java	2001/01/28 22:21:57	1.7
  @@ -66,7 +66,7 @@
    * Perl5Compiler.
   
    @author <a href="mailto:dfs@savarese.org">Daniel F. Savarese</a>
  - @version $Id: Perl5Matcher.java,v 1.6 2000/12/24 03:34:25 dfs Exp $
  + @version $Id: Perl5Matcher.java,v 1.7 2001/01/28 22:21:57 dfs Exp $
   
    * @see PatternMatcher
    * @see Perl5Compiler
  @@ -1504,26 +1504,6 @@
         inp = input._toLowerBuffer;
       } else
         inp = __originalInput;
  -
  -    /*
  -    if(__interpret(expression, inp, input._beginOffset,
  -	       input._endOffset)) {
  -      // debug
  -
  -      //System.err.println("contains: " + getMatch());
  -      //System.err.println(__lastMatchResult.beginOffset(0) + "-" + 
  -      //__lastMatchResult.endOffset(0));
  -      //System.err.println(input._beginOffset + "-" + 
  -      //input._endOffset);
  -
  -      if(__lastMatchResult.beginOffset(0) == input._beginOffset && 
  -	 __lastMatchResult.endOffset(0) == input._endOffset)
  -	return true;
  -      // Handle special case.
  -      if(input.length() == 0 || (input._beginOffset == input._endOffset))
  -	return true;
  -    }
  -    */
   
       __initInterpreterGlobals(expression, inp, input._beginOffset,
   			    input._endOffset, input._beginOffset);
  
  
  

Mime
View raw message