From 79cc7f749e4694d923330f444d1fd3a2c05fed9b Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sun, 6 Nov 2005 04:06:25 +0000 Subject: [PATCH] Add support for the Java 1.5 enum keyword. (Kian Win Ong) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1381 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 2 ++ src/engine/SCons/Tool/JavaCommon.py | 2 +- src/engine/SCons/Tool/JavaCommonTests.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 56881786..b94a7f7d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -523,6 +523,8 @@ RELEASE 0.97 - XXX - When building a .jar file and there is a $JARCHDIR, put the -C in front of each .class file on the command line. + - Recognize the Java 1.5 enum keyword. + From Chris Pawling: - Have the linkloc tool use $MSVS_VERSION to select the Microsoft diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 96d6486f..06a4199a 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -115,7 +115,7 @@ if java_parsing: if len(self.listClasses) > 0: return self.__getAnonClassState() return self.__getSkipState() # Skip the class name - elif token == 'class' or token == 'interface': + elif token in ['class', 'interface', 'enum']: if len(self.listClasses) == 0: self.nextAnon = 1 self.stackBrackets.append(self.brackets) diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py index f8f38c2b..484fbf8e 100644 --- a/src/engine/SCons/Tool/JavaCommonTests.py +++ b/src/engine/SCons/Tool/JavaCommonTests.py @@ -202,6 +202,16 @@ public class MyTabs assert pkg_dir == None, pkg_dir assert classes == ['MyTabs$MyInternal', 'MyTabs'], classes + def test_enum(self): + """Test the Java 1.5 enum keyword""" + + pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\ +package p; +public enum a {} +""") + assert pkg_dir == 'p', pkg_dir + assert classes == ['a'], classes + if __name__ == "__main__": suite = unittest.TestSuite() tclasses = [ parse_javaTestCase ] -- 2.26.2