You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by jo...@apache.org on 2002/12/03 21:57:52 UTC

cvs commit: jakarta-regexp/src/java/org/apache/regexp RE.java RECompiler.java REProgram.java

jon         2002/12/03 12:57:52

  Modified:    docs     RETest.txt
               src/java/org/apache/regexp RE.java RECompiler.java
                        REProgram.java
  Added:       .        LICENSE.txt
               build    build.xml
  Removed:     .        LICENSE
               build    ant-1.2.jar build-regexp.bat build-regexp.sh
                        build-regexp.xml run-tests.bat run-tests.sh
                        xerces-1.2.1.jar
               build/bin antRun
  Log:
  applied patches for http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8467
  
  modernized the build system and removed old crud
  
  renamed LICENSE to LICENSE.txt
  
  Revision  Changes    Path
  1.1                  jakarta-regexp/LICENSE.txt
  
  Index: LICENSE.txt
  ===================================================================
  /*
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
   
  
  
  
  1.1                  jakarta-regexp/build/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- ======================================================================= -->
  <!-- Build file                                                              -->
  <!-- ======================================================================= -->
  <project name="Jakarta-Regexp" default="jar" basedir=".">
  
      <!-- Allow the user to have multiple configuration files and
           specify them using -Dconfiguration.file=filename -->
      <property name="configuration.file" value="build.properties"/> 
  
      <!-- Give user a chance to override without editing this file
           (and without using -D arguments each time they build) -->
      <property file="${user.home}/jakarta-regexp.build.properties" /> 
      <property file="${user.home}/build.properties" />
      <property file="${basedir}/${configuration.file}" />
      <property file="${basedir}/default.properties" />
  
      <!-- =================================================================== -->
      <!-- Initializes some variables                                          -->
      <!-- =================================================================== -->
      <property name="ant.home" value="."/>
      <property name="Name" value="Jakarta-Regexp"/>
      <property name="year" value="2001-2002"/>
      <property name="version" value="1.3-dev"/>
      <property name="project" value="jakarta-regexp"/>
  
      <property name="build.dir" value="../bin"/>
      <property name="build.src" value="${build.dir}/src"/>
      <property name="build.dest" value="${build.dir}/classes"/>
      <property name="src.java.dir" value="../src/java"/>
      <property name="javadoc.destdir" value="../docs/api/"/>
      <property name="final.name" value="${project}-${version}"/>
      <property name="final.dir" value="../${final.name}/"/>
      <property name="debug" value="off"/>
      <property name="optimize" value="on"/>
      <property name="deprecation" value="off"/>
      <property name="RETest.txt" value="../docs/RETest.txt"/>
      <property name="jakarta-site2.dir" value="../../jakarta-site2"/>
  
      <!-- Anakia -->
      <property name="docs.src" value="../xdocs"/>
      <property name="docs.dest" value="../docs"/>
  
      <!-- Build classpath -->
      <path id="classpath">
          <fileset dir="${jakarta-site2.dir}/lib">
              <include name="velocity-1.*.jar"/>
              <include name="xerces*.jar"/>
          </fileset>
      </path>
  
      <!-- =================================================================== -->
      <!-- Copies the source code to the build directory and does filtering    -->
      <!-- =================================================================== -->
      <target name="prepare">
          <tstamp/>
          <filter token="year" value="${year}"/>
          <filter token="version" value="${version}"/>
          <filter token="date" value="${TODAY}"/>
  
          <available classname="org.apache.velocity.anakia.AnakiaTask"
              property="AnakiaTask.present">
              <classpath refid="classpath"/>
          </available>
  
          <mkdir dir="${build.dir}"/>
          <mkdir dir="${build.dest}"/>
          <mkdir dir="${build.src}"/>
          <chmod dir="bin/" perm="744"/>
  
          <copy todir="${build.src}" filtering="yes">
              <fileset dir="${src.java.dir}">
                  <include name="**/*.java"/>
                  <include name="**/*.properties"/>
                  <include name="**/package.html"/>
              </fileset>
          </copy>
      </target>
  
      <!-- =================================================================== -->
      <!-- Compiles the source directory                                       -->
      <!-- =================================================================== -->
      <target name="compile" depends="prepare">
          <javac srcdir="${build.src}"
              destdir="${build.dest}"
              excludes="**/package.html"
              debug="${debug}"
              deprecation="${deprecation}"
              optimize="${optimize}"/>
      </target>
  
      <!-- =================================================================== -->
      <!-- Compiles the source directory and creates a .jar file               -->
      <!-- =================================================================== -->
      <target name="jar" depends="compile">
          <jar jarfile="${build.dir}/${final.name}.jar"
              basedir="${build.dest}"
              excludes="**/package.html"/>
      </target>
  
      <!-- =================================================================== -->
      <!-- Creates the API documentation                                       -->
      <!-- =================================================================== -->
      <target name="javadocs" depends="prepare">
          <mkdir dir="${javadoc.destdir}"/>
          <javadoc
              sourcepath="${build.src}"
              packagenames="org.apache.regexp.*"
              destdir="${javadoc.destdir}"
              author="true"
              private="true"
              version="true"
              use="true"
              windowtitle="${Name} ${version} API"
              doctitle="${Name} ${version} API"
              bottom="Copyright &amp;copy; ${year} Apache Software Foundation. All Rights Reserved."
              >
        </javadoc>
      </target>
  
      <!-- =================================================================== -->
      <!-- Package                                                             -->
      <!-- =================================================================== -->
      <target name="package" depends="jar,docs,javadocs">
          <mkdir dir="${final.dir}"/>
  
          <copy todir="${final.dir}/src/java">
              <fileset dir="${src.java.dir}"/>
          </copy>
          <copy todir="${final.dir}/docs">
              <fileset dir="${docs.dest}">
                  <exclude name="**/dist/**"/>
              </fileset>
          </copy>
          <copy todir="${final.dir}/xdocs">
              <fileset dir="${docs.src}"/>
          </copy>
          <copy todir="${final.dir}/build">
              <fileset dir="../build">
                  <exclude name="velocity.log"/>
              </fileset>
          </copy>
          <copy file="../LICENSE" tofile="${final.dir}/LICENSE"/>
          <copy file="${build.dir}/${final.name}.jar" tofile="${final.dir}/${final.name}.jar"/>
      </target>
  
      <!-- =================================================================== -->
      <!-- Packages the distribution with ZIP                                  -->
      <!-- =================================================================== -->
      <target name="package-zip" depends="package">
          <delete file="../${final.name}.zip" verbose="false"/>
          <zip zipfile="../${final.name}.zip" basedir="../${final.name}" includes="**/**"/>
      </target>
  
      <!-- =================================================================== -->
      <!-- Packages the distribution with TAR-GZIP                             -->
      <!-- =================================================================== -->
      <target name="package-tgz" depends="package">
          <delete file="../${final.name}.tar" verbose="false"/>
          <delete file="../${final.name}.tar.gz" verbose="false"/>
          <tar tarfile="../${final.name}.tar" basedir="../" includes="**/${final.name}/**"/>
          <gzip zipfile="../${final.name}.tar.gz" src="../${final.name}.tar"/>
      </target>
  
      <!-- =================================================================== -->
      <!-- Packages the distribution with ZIP and TAG-GZIP                     -->
      <!-- =================================================================== -->
      <target name="package-all" depends="package-zip, package-tgz">
      </target>
  
      <!-- ================================================================== -->
      <!-- I N S T A L L  J A R                                               -->
      <!-- ================================================================== -->
      <target name="install-jar" depends="jar" 
              description="--> Installs .jar file in ${lib.repo}">
        <copy todir="${lib.repo}" filtering="no">
          <fileset dir="${build.dir}">
            <include name="${final.name}.jar"/>
          </fileset>
        </copy>
      </target>
  
      <!-- ================================================================== -->
      <!-- I N S T A L L  J A R                                               -->
      <!-- ================================================================== -->
      <target name="test" depends="jar">
        <java classname="org.apache.regexp.RETest" fork="yes">
          <arg value="${RETest.txt}"/>
          <classpath>
            <fileset dir="${build.dir}">
              <include name="${final.name}.jar"/>
            </fileset>
          </classpath>
        </java>
      </target>
  
      <!-- ================================================================== -->
      <!-- Cleans up the build directory                                      -->
      <!-- ================================================================== -->
      <target name="clean">
          <delete dir="${build.dir}"/>
      </target>
  
      <!-- ================================================================== -->
      <!-- Anakia Documentation Builder                                       -->
      <!-- ================================================================== -->
      <target depends="prepare" name="prepare-error" unless="AnakiaTask.present">
          <echo>
              AnakiaTask is not present! Please check to make sure that
              velocity.jar is in your classpath.
          </echo>
      </target>
  
      <target name="docs" depends="prepare-error" if="AnakiaTask.present">
          <taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask"/>
          <anakia basedir="${docs.src}" destdir="${docs.dest}/"
               extension=".html" style="./site.vsl"
               projectFile="stylesheets/project.xml"
               excludes="**/stylesheets/** empty.xml"
               includes="**/*.xml"
               lastModifiedCheck="true"
               velocityPropertiesFile="${docs.src}/velocity.properties">
          </anakia>
          <!-- Not needed for now
          <copy todir="${docs.dest}/images" filtering="no">
              <fileset dir="${docs.src}/images">
                  <include name="**/*.gif"/>
                  <include name="**/*.jpeg"/>
                  <include name="**/*.jpg"/>
              </fileset>
          </copy>
          -->
          <copy todir="${docs.dest}" filtering="no">
              <fileset dir="${docs.src}">
                  <include name="RETest.txt"/>
              </fileset>
          </copy>
      </target>
  
  </project>
  
  
  
  1.4       +22 -1     jakarta-regexp/docs/RETest.txt
  
  Index: RETest.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/docs/RETest.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RETest.txt	27 Feb 2001 08:37:05 -0000	1.3
  +++ RETest.txt	3 Dec 2002 20:57:51 -0000	1.4
  @@ -1011,4 +1011,25 @@
   YES
   aaabc
   
  -
  +#168
  +a(.+)b(.+)c(.+)d(.+)e(.+)f(.+)g(.+)h(.+)i(.+)j(.+)k(.+)l(.+)m(.+)n(.+)o(.+)p(.+)q(.+)r
  +a01b02c03d04e05f06g07h08i09j10k11l12m13n14o15p16q17r
  +YES
  +a01b02c03d04e05f06g07h08i09j10k11l12m13n14o15p16q17r
  +01
  +02
  +03
  +04
  +05
  +06
  +07
  +08
  +09
  +10
  +11
  +12
  +13
  +14
  +15
  +16
  +17
  
  
  
  1.10      +8 -2      jakarta-regexp/src/java/org/apache/regexp/RE.java
  
  Index: RE.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/RE.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RE.java	9 Mar 2001 22:17:13 -0000	1.9
  +++ RE.java	3 Dec 2002 20:57:52 -0000	1.10
  @@ -452,7 +452,7 @@
   
       // Limits
       static final int maxNode  = 65536;            // Maximum number of nodes in a program
  -    static final int maxParen = 16;               // Number of paren pairs (only 9 can be backrefs)
  +    static final int MAX_PAREN = 16;              // Number of paren pairs (only 9 can be backrefs)
   
       // Node layout constants
       static final int offsetOpcode = 0;            // Opcode offset (first character)
  @@ -468,6 +468,7 @@
       CharacterIterator search;                                // The string being matched against
       int idx;                                      // Current index in string being searched
       int matchFlags;                               // Match behaviour flags
  +    int maxParen = MAX_PAREN;
   
       // Parenthesized subexpressions
       int parenCount;                               // Number of subexpressions matched (num open parens + 1)
  @@ -647,6 +648,11 @@
       public void setProgram(REProgram program)
       {
           this.program = program;
  +        if (program != null && program.maxParens != -1) {
  +            this.maxParen = program.maxParens;
  +        } else {
  +            this.maxParen = MAX_PAREN;
  +        }
       }
   
       /**
  
  
  
  1.5       +2 -2      jakarta-regexp/src/java/org/apache/regexp/RECompiler.java
  
  Index: RECompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/RECompiler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RECompiler.java	27 Feb 2001 08:37:05 -0000	1.4
  +++ RECompiler.java	3 Dec 2002 20:57:52 -0000	1.5
  @@ -1331,7 +1331,7 @@
           // Return the result
           char[] ins = new char[lenInstruction];
           System.arraycopy(instruction, 0, ins, 0, lenInstruction);
  -        return new REProgram(ins);
  +        return new REProgram(parens, ins);
       }
   
       /**
  
  
  
  1.2       +13 -1     jakarta-regexp/src/java/org/apache/regexp/REProgram.java
  
  Index: REProgram.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/REProgram.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- REProgram.java	27 Apr 2000 01:22:33 -0000	1.1
  +++ REProgram.java	3 Dec 2002 20:57:52 -0000	1.2
  @@ -80,6 +80,7 @@
       int lenInstruction;         // The amount of the instruction buffer in use
       char[] prefix;              // Prefix string optimization
       int flags;                  // Optimization flags (REProgram.OPT_*)
  +    int maxParens = -1;
   
       /**
        * Constructs a program object from a character array
  @@ -88,6 +89,17 @@
       public REProgram(char[] instruction)
       {
           this(instruction, instruction.length);
  +    }
  +
  +    /**
  +     * Constructs a program object from a character array
  +     * @param parens Count of parens in the program
  +     * @param instruction Character array with RE opcode instructions in it
  +     */
  +    public REProgram(int parens, char[] instruction)
  +    {
  +        this(instruction, instruction.length);
  +        this.maxParens = parens;
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>