better type-checking, decompilation
--HG-- branch : pmacs2
This commit is contained in:
parent
8895902f4f
commit
88a1198a87
|
@ -32,7 +32,7 @@ class SubTypeGrammar(Grammar): pass
|
|||
SubTypeGrammar.rules = [
|
||||
RegionRule('sub', r'\[', SubTypeGrammar, r'\]'),
|
||||
#PatternRule('scala.type', '(?:[a-zA-Z0-9_.]+| *=> *)+'),
|
||||
PatternRule('scala.type', '[A-Z][a-zA-Z0-9_.]+'),
|
||||
PatternRule('scala.type', '[A-Z][a-zA-Z0-9_.]*'),
|
||||
PatternRule('spaces', ' +'),
|
||||
PatternRule('scala.annotation', '@[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||
]
|
||||
|
@ -81,12 +81,12 @@ class ScalaGrammar(Grammar):
|
|||
|
||||
PatternRule('scala.reserved', '(?:yield|with|while|var|val|until|type|true|try|trait|throw|to|this|super|sealed|return|protected|private|package|override|object|null|new|match|lazy|import|implicit|if|forSome|for|finally|final|false|extends|else|do|def|class|catch|case|abstract)(?!%s)' % word),
|
||||
|
||||
PatternRule('scala.float', r'-?[0-9]+\.[0-9]*[Ff]?'), # FIXME
|
||||
|
||||
PatternRule('scala.integer', '-?(?:0|[1-9])[0-9]*[Ll]?'),
|
||||
PatternRule('scala.integer', '-?0x[0-9A-Fa-f]+[Ll]?'),
|
||||
PatternRule('scala.integer', '-?0[0-7]+[Ll]?'),
|
||||
|
||||
PatternRule('scala.float', r'-?[0-9]+\.[0-9]*'), # FIXME
|
||||
|
||||
PatternRule('scala.char', r"'(?:[^'\\]|\\u[0-9A-Fa-f]{4}|\\[0-7]{1,3}|\\[btnfr\"'\\])'"),
|
||||
RegionRule('scala.string', '"""', Grammar, '"""'),
|
||||
RegionRule('scala.string', '"', StringGrammar, '"'),
|
||||
|
@ -202,6 +202,7 @@ class ScalaDecompile(Method):
|
|||
|
||||
field_re = re.compile('^Field\s+([^:]+):(.+)$')
|
||||
long_re = re.compile('^long\s+(\d+)[lL]$')
|
||||
double_re = re.compile('^double\s+([\d.]+)[dD]$')
|
||||
sig_re = re.compile('^(\w+)\s+([^:]+):\(([^)]*)\)(.+)$')
|
||||
def _parse_sig(self, line):
|
||||
if line.startswith('class'):
|
||||
|
@ -223,7 +224,10 @@ class ScalaDecompile(Method):
|
|||
return 'long %s' % line[5:]
|
||||
|
||||
elif line.startswith('int'):
|
||||
return 'int %s' % line[5:]
|
||||
return 'int %s' % line[4:]
|
||||
|
||||
elif line.startswith('double'):
|
||||
return 'double %s' % line[7:]
|
||||
|
||||
else:
|
||||
m = self.sig_re.match(line)
|
||||
|
|
Loading…
Reference in New Issue