ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant WHATSNEW
Date Fri, 13 Aug 2004 09:14:20 GMT
antoine     2004/08/13 02:14:20

  Modified:    src/main/org/apache/tools/ant/types Tag: ANT_16_BRANCH
                        RegularExpression.java
               docs/manual/OptionalTasks Tag: ANT_16_BRANCH
                        replaceregexp.html
               docs/manual Tag: ANT_16_BRANCH conceptstypeslist.html
               .        Tag: ANT_16_BRANCH WHATSNEW
  Added:       docs/manual/CoreTypes Tag: ANT_16_BRANCH regexp.html
  Log:
  Merge the solution to PR 15390 from HEAD (allow choice of regular expression implementation)
  PR: 15390
  PR: 30185
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.1   +0 -0      ant/docs/manual/CoreTypes/regexp.html
  
  Index: regexp.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTypes/regexp.html,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  
  
  
  No                   revision
  No                   revision
  1.15.2.5  +45 -6     ant/src/main/org/apache/tools/ant/types/RegularExpression.java
  
  Index: RegularExpression.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/RegularExpression.java,v
  retrieving revision 1.15.2.4
  retrieving revision 1.15.2.5
  diff -u -r1.15.2.4 -r1.15.2.5
  --- RegularExpression.java	9 Mar 2004 17:01:55 -0000	1.15.2.4
  +++ RegularExpression.java	13 Aug 2004 09:14:20 -0000	1.15.2.5
  @@ -61,42 +61,81 @@
   public class RegularExpression extends DataType {
       /** Name of this data type */
       public static final String DATA_TYPE_NAME = "regexp";
  +    private boolean alreadyInit = false;
   
       // The regular expression factory
  -    private static final RegexpFactory factory = new RegexpFactory();
  +    private static final RegexpFactory FACTORY = new RegexpFactory();
   
  -    private Regexp regexp;
  +    private Regexp regexp = null;
  +    // temporary variable
  +    private String myPattern;
  +    private boolean setPatternPending = false;
   
  +    /**
  +     * default constructor
  +     */
       public RegularExpression() {
  -        this.regexp = factory.newRegexp();
       }
   
  +    private void init(Project p) {
  +        if (!alreadyInit) {
  +            this.regexp = FACTORY.newRegexp(p);
  +            alreadyInit = true;
  +        }
  +    }
  +    private void setPattern() {
  +        if (setPatternPending) {
  +            regexp.setPattern(myPattern);
  +            setPatternPending = false;
  +        }
  +    }
  +    /**
  +     * sets the regular expression pattern
  +     * @param pattern regular expression pattern
  +     */
       public void setPattern(String pattern) {
  -        this.regexp.setPattern(pattern);
  +        if (regexp == null) {
  +            myPattern = pattern;
  +            setPatternPending = true;
  +        } else {
  +            regexp.setPattern(pattern);
  +        }
       }
   
       /***
        * Gets the pattern string for this RegularExpression in the
        * given project.
  +     * @param p project
  +     * @return pattern
        */
       public String getPattern(Project p) {
  +        init(p);
           if (isReference()) {
               return getRef(p).getPattern(p);
           }
  -
  +        setPattern();
           return regexp.getPattern();
       }
   
  +    /**
  +     * provides a reference to the Regexp contained in this
  +     * @param p  project
  +     * @return   Regexp instance associated with this RegularExpression instance
  +     */
       public Regexp getRegexp(Project p) {
  +        init(p);
           if (isReference()) {
               return getRef(p).getRegexp(p);
           }
  +        setPattern();
           return this.regexp;
       }
   
       /***
        * Get the RegularExpression this reference refers to in
        * the given project.  Check for circular references too
  +     * @param p project
  +     * @return resolved RegularExpression instance
        */
       public RegularExpression getRef(Project p) {
           if (!isChecked()) {
  @@ -109,7 +148,7 @@
           Object o = getRefid().getReferencedObject(p);
           if (!(o instanceof RegularExpression)) {
               String msg = getRefid().getRefId() + " doesn\'t denote a "
  -                + DATA_TYPE_NAME;
  +                    + DATA_TYPE_NAME;
               throw new BuildException(msg);
           } else {
               return (RegularExpression) o;
  
  
  
  No                   revision
  No                   revision
  1.16.2.4  +4 -43     ant/docs/manual/OptionalTasks/replaceregexp.html
  
  Index: replaceregexp.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/replaceregexp.html,v
  retrieving revision 1.16.2.3
  retrieving revision 1.16.2.4
  diff -u -r1.16.2.3 -r1.16.2.4
  --- replaceregexp.html	9 Feb 2004 22:12:11 -0000	1.16.2.3
  +++ replaceregexp.html	13 Aug 2004 09:14:20 -0000	1.16.2.4
  @@ -20,7 +20,8 @@
   <p>Similar to <a href="../CoreTypes/mapper.html#regexp-mapper">regexp
   type mappers</a> this task needs a supporting regular expression
   library and an implementation of
  -<code>org.apache.tools.ant.util.regexp.Regexp</code>. See details <a href="#implementation">below</a>.
</p>
  +<code>org.apache.tools.ant.util.regexp.Regexp</code>.
  +See details in the documentation of the <a href=../CoreTypes/regexp.html#implementation">Regexp
Type</a>. </p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -80,51 +81,11 @@
   <p>replaces occurrences of the property name &quot;OldProperty&quot;
    with &quot;NewProperty&quot; in a properties file, preserving the existing
   value, in the file <code>${src}/build.properties</code></p>
  -<a name="implementation"/>
  -<h3>Choice of regular expression implementation</h3>
  -<p>
  -Ant comes with
  -wrappers for
  -<a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html"
target="_top">the java.util.regex package of JDK 1.4</a>,
  -<a href="http://jakarta.apache.org/regexp/" target="_top">jakarta-regexp</a>
  -and <a href="http://jakarta.apache.org/oro/" target="_top">jakarta-ORO</a>,
  -See <a href="../install.html#librarydependencies">installation dependencies</a>
  - concerning the supporting libraries.</p>
  -<p>
  -The system property <code>ant.regexp.regexpimpl</code> governs which regular
expression implementation will be chosen.
  -Possible values for this property are :
  -<ul>
  -<li>
  -org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp
  -</li>
  -<li>
  -org.apache.tools.ant.util.regexp.JakartaOroRegexp
  -</li>
  -<li>
  -org.apache.tools.ant.util.regexp.JakartaRegexpRegexp
  -</li>
  -</ul>
  -It can also be another implementation of the interface <code>org.apache.tools.ant.util.regexp.Regexp</code>.
  -If <code>ant.regexp.regexpimpl</code> is not defined, ant checks in the order
Jdk14Regexp, JakartaOroRegexp,
  - JakartaRegexp for the availability of the corresponding library. The first of these 3
which is found will be used.</p>
  -<p>
  -There are cross-platform issues for matches related to line terminator.
  -For example if you use $ to anchor your regular expression on the end of a line
  -the results might be very different depending on both your platform and the regular
  -expression library you use. It is 'highly recommended' that you test your pattern on
  -both Unix and Windows platforms before you rely on it.
  -<ul>
  -    <li>Jakarta Oro defines a line terminator as '\n' and is consistent with Perl.</li>
  -    <li>Jakarta RegExp uses a system-dependant line terminator.</li>
  -    <li>JDK 1.4 uses '\n', '\r\n', '\u0085', '\u2028', '\u2029' as a default
  -    but is configured in the wrapper to use only '\n' (UNIX_LINE)</li>
  -</ul>
  -<em>We <b>strongly</b> recommend that you use Jakarta Oro.</em>
  -</p>
  +
   <h3>Parameters specified as nested elements</h3>
   <p>This task supports a nested <a href="../CoreTypes/fileset.html">FileSet</a>
      element.</p>
  -<p>This task supports a nested <i>Regexp</i> element to specify
  +<p>This task supports a nested <i><a href="../CoreTypes/regexp.html">Regexp</a></i>
element to specify
      the regular expression.  You can use this element to refer to a previously
      defined regular expression datatype instance.</p>
   <blockquote>
  
  
  
  No                   revision
  No                   revision
  1.13.2.5  +1 -0      ant/docs/manual/conceptstypeslist.html
  
  Index: conceptstypeslist.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/conceptstypeslist.html,v
  retrieving revision 1.13.2.4
  retrieving revision 1.13.2.5
  diff -u -r1.13.2.4 -r1.13.2.5
  --- conceptstypeslist.html	23 Jun 2004 19:17:12 -0000	1.13.2.4
  +++ conceptstypeslist.html	13 Aug 2004 09:14:20 -0000	1.13.2.5
  @@ -30,6 +30,7 @@
   <a href="CoreTypes/permissions.html">Permissions</a><br>
   <a href="CoreTypes/propertyset.html">PropertySet</a><br>
   <a href="CoreTypes/redirector.html">I/O Redirectors</a><br>
  +<a href="CoreTypes/regexp.html">Regexp</a><br>
   <a href="CoreTypes/selectors.html">Selectors</a><br>
   <a href="CoreTypes/xmlcatalog.html">XMLCatalog</a><br>
   <a href="CoreTypes/zipfileset.html">ZipFileSet</a><br>
  
  
  
  No                   revision
  No                   revision
  1.503.2.124 +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.123
  retrieving revision 1.503.2.124
  diff -u -r1.503.2.123 -r1.503.2.124
  --- WHATSNEW	27 Jul 2004 07:15:10 -0000	1.503.2.123
  +++ WHATSNEW	13 Aug 2004 09:14:20 -0000	1.503.2.124
  @@ -24,6 +24,9 @@
     when Ant core loader != Java application loader and Path.systemClassPath taken from ${java.class.path}
     Bugzilla 30161.  
   
  +* Enable to choose the regexp implementation without system property.
  +  Bugzilla Report 15390.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message