Fix Java parsing when a string is encountered. (Christian Neeb)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 12 Oct 2004 14:01:19 +0000 (14:01 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 12 Oct 2004 14:01:19 +0000 (14:01 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1127 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Tool/JavaCommon.py
src/engine/SCons/Tool/JavaCommonTests.py

index f02407c0d787775111a54cb04881a799b9a8c9d4..93fe5a7c7b3a9d3a0662aeb0ade5ae71e4208718 100644 (file)
@@ -104,6 +104,11 @@ RELEASE 0.97 - XXX
   - Enhance the tests to guarantee persistence of ListOption
     values in saved options files.
 
+  From Christian Neeb:
+
+  - Fix the Java parser's handling of string definitions to avoid ignoring
+    subsequent code.
+
   From Han-Wen Nienhuys:
 
   - Optimize variable expansion by:  using the re.sub() method (when
index 6b69c7367cfa73d2d14ba1fff3e1907be2e1f6d5..72196e315d0936b88957ecf0093c6b158371bb24 100644 (file)
@@ -140,9 +140,12 @@ if java_parsing:
             self.outer_state = outer_state
             self.tokens_to_find = 2
         def parseToken(self, token):
-            # This is an anonymous class if and only if the next token is a bracket
+            # This is an anonymous class if and only if the next token
+            # is a bracket
             if token == '{':
                 self.outer_state.addAnonClass()
+            elif token in ['"', "'"]:
+                return IgnoreState(token, self)
             return self.outer_state
 
     class SkipState:
index 2bb3be6a018aa802d1ccf3168ddcf16c8b2e3d5d..46d1955c732feb945761358e633b8bb366458dfd 100644 (file)
@@ -43,6 +43,9 @@ public class Foo
      public static void main(String[] args)
      {
 
+        /* This tests a former bug where strings would eat later code. */
+        String hello1 = new String("Hello, world!");
+
      }
 
 }