diff options
author | Steven Knight <knight@baldmt.com> | 2004-10-12 14:01:19 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-10-12 14:01:19 (GMT) |
commit | a91921dc92ba759f707e820c3c1a1b1a808877a8 (patch) | |
tree | 6f9aeb5edb08ac3883b115afcebd75e1408c8078 | |
parent | a25ffc30acc38fd1bdf06b448ace9f92ce5664a9 (diff) | |
download | SCons-a91921dc92ba759f707e820c3c1a1b1a808877a8.zip SCons-a91921dc92ba759f707e820c3c1a1b1a808877a8.tar.gz SCons-a91921dc92ba759f707e820c3c1a1b1a808877a8.tar.bz2 |
Fix Java parsing when a string is encountered. (Christian Neeb)
-rw-r--r-- | src/CHANGES.txt | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/JavaCommon.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/JavaCommonTests.py | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f02407c..93fe5a7 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -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 diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 6b69c73..72196e3 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -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: diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py index 2bb3be6..46d1955 100644 --- a/src/engine/SCons/Tool/JavaCommonTests.py +++ b/src/engine/SCons/Tool/JavaCommonTests.py @@ -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!"); + } } |