ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/filters StripJavaComments.java
Date Thu, 27 Mar 2003 17:03:13 GMT
bodewig     2003/03/27 09:03:13

  Modified:    src/etc/testcases/filters/expected stripjavacomments.test
               src/main/org/apache/tools/ant/filters StripJavaComments.java
  Log:
  <stripjavacomments> would consider // inside String constants comments.
  
  PR: 17441
  Submitted by:	Jan Materne <jan at materne dot de>
  
  Revision  Changes    Path
  1.2       +1 -1      ant/src/etc/testcases/filters/expected/stripjavacomments.test
  
  Index: stripjavacomments.test
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/filters/expected/stripjavacomments.test,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- stripjavacomments.test	27 Mar 2003 16:54:00 -0000	1.1
  +++ stripjavacomments.test	27 Mar 2003 17:03:12 -0000	1.2
  @@ -14,6 +14,6 @@
       }
   
       private String url = "http://ant.apache.org/"; 
  -    private String url2 = "\"http://ant.apache.org/\"";
  +    private String url2 = "\"http://ant.apache.org/\""; 
   
   }
  
  
  
  1.9       +11 -2     ant/src/main/org/apache/tools/ant/filters/StripJavaComments.java
  
  Index: StripJavaComments.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/filters/StripJavaComments.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StripJavaComments.java	10 Feb 2003 14:13:32 -0000	1.8
  +++ StripJavaComments.java	27 Mar 2003 17:03:13 -0000	1.9
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -80,6 +80,11 @@
        */
       private boolean inString = false;
   
  +    /** 
  +     * Whether or not the last char has been a backslash.
  +     */
  +    private boolean quoted = false;
  +
       /**
        * Constructor for "dummy" instances.
        * 
  @@ -116,9 +121,13 @@
               readAheadCh = -1;
           } else {
               ch = in.read();
  -            if (ch == '"') {
  +            if (ch == '"' && !quoted) {
                   inString = !inString;
  +                quoted = false;
  +            } else if (ch == '\\') {
  +                quoted = !quoted;
               } else {
  +                quoted = false;
                   if (!inString) {
                       if (ch == '/') {
                           ch = in.read();
  
  
  

Mime
View raw message