summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/JavaCommon.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Tool/JavaCommon.py')
-rw-r--r--src/engine/SCons/Tool/JavaCommon.py34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py
index 09ce1d1..177d579 100644
--- a/src/engine/SCons/Tool/JavaCommon.py
+++ b/src/engine/SCons/Tool/JavaCommon.py
@@ -51,8 +51,9 @@ if java_parsing:
# any alphanumeric token (keyword, class name, specifier);
# the multi-line comment begin and end tokens /* and */;
# array declarations "[]";
- # semi-colons.
- _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;]|' +
+ # semi-colons;
+ # periods.
+ _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;\.]|' +
r'[A-Za-z_][\w\.]*|/\*|\*/|\[\])')
class OuterState:
@@ -101,20 +102,26 @@ if java_parsing:
self.skipState = ret
return ret
+ def openBracket(self):
+ self.brackets = self.brackets + 1
+
+ def closeBracket(self):
+ self.brackets = self.brackets - 1
+ if len(self.stackBrackets) and \
+ self.brackets == self.stackBrackets[-1]:
+ self.listOutputs.append(string.join(self.listClasses, '$'))
+ self.listClasses.pop()
+ self.stackBrackets.pop()
+
def parseToken(self, token):
if token[:2] == '//':
return IgnoreState('\n', self)
elif token == '/*':
return IgnoreState('*/', self)
elif token == '{':
- self.brackets = self.brackets + 1
+ self.openBracket()
elif token == '}':
- self.brackets = self.brackets - 1
- if len(self.stackBrackets) and \
- self.brackets == self.stackBrackets[-1]:
- self.listOutputs.append(string.join(self.listClasses, '$'))
- self.listClasses.pop()
- self.stackBrackets.pop()
+ self.closeBracket()
elif token in [ '"', "'" ]:
return IgnoreState(token, self)
elif token == "new":
@@ -129,13 +136,17 @@ if java_parsing:
return self.__getClassState()
elif token == 'package':
return self.__getPackageState()
+ elif token == '.':
+ # Skip the attribute, it might be named "class", in which
+ # case we don't want to treat the following token as
+ # an inner class name...
+ return self.__getSkipState()
return self
def addAnonClass(self):
"""Add an anonymous inner class"""
clazz = self.listClasses[0]
self.listOutputs.append('%s$%d' % (clazz, self.nextAnon))
- self.brackets = self.brackets + 1
self.nextAnon = self.nextAnon + 1
def setPackage(self, package):
@@ -153,7 +164,10 @@ if java_parsing:
if token == '\n':
return self
if token == '{':
+ self.outer_state.openBracket()
self.outer_state.addAnonClass()
+ elif token == '}':
+ self.outer_state.closeBracket()
elif token in ['"', "'"]:
return IgnoreState(token, self)
return self.outer_state