diff --git a/smali/src/main/jflex/smaliLexer.jflex b/smali/src/main/jflex/smaliLexer.jflex index 1bae56e1..4d0b5456 100644 --- a/smali/src/main/jflex/smaliLexer.jflex +++ b/smali/src/main/jflex/smaliLexer.jflex @@ -225,8 +225,11 @@ HighSurrogate = [\ud800-\udbff] LowSurrogate = [\udc00-\udfff] SimpleNameCharacter = ({HighSurrogate} {LowSurrogate}) | [A-Za-z0-9$\-_\u00a1-\u1fff\u2010-\u2027\u2030-\ud7ff\ue000-\uffef] +UnicodeSpace = [\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000] /* Zs category */ -SimpleName = {SimpleNameCharacter}+ +SimpleNameRaw = {SimpleNameCharacter}+ +SimpleNameQuoted = [`] ({SimpleNameCharacter} | {UnicodeSpace})+ [`] +SimpleName = {SimpleNameRaw} | {SimpleNameQuoted} PrimitiveType = [ZBSCIJFD] @@ -682,8 +685,13 @@ Type = {PrimitiveType} | {ClassDescriptor} | {ArrayPrefix} ({ClassDescriptor} | yybegin(PARAM_LIST); } - {SimpleName} { return newToken(SIMPLE_NAME); } - "<" {SimpleName} ">" { return newToken(MEMBER_NAME); } + {SimpleNameRaw} { return newToken(SIMPLE_NAME); } + {SimpleNameQuoted} { + String quoted = yytext(); + String raw = quoted.substring(1, quoted.length() - 1); /* strip backticks */ + return newToken(SIMPLE_NAME, raw); + } + "<" {SimpleNameRaw} ">" { return newToken(MEMBER_NAME); } } /*Symbols/Whitespace/EOF*/ diff --git a/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.smali b/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.smali index 9becb916..2c0a6374 100644 --- a/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.smali +++ b/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.smali @@ -53,4 +53,6 @@ L[Ljava/lang/String; III -[I->clone()Ljava/lang/Object; \ No newline at end of file +[I->clone()Ljava/lang/Object; + +`method_with_spaces_20 a0 1680 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200a 202f 205f 3000 ` diff --git a/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.tokens b/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.tokens index b0b66dbd..1652ab98 100644 --- a/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.tokens +++ b/smali/src/test/resources/LexerTest/TypeAndIdentifierTest.tokens @@ -107,4 +107,6 @@ ARROW("->") SIMPLE_NAME("clone") OPEN_PAREN("(") CLOSE_PAREN(")") -CLASS_DESCRIPTOR("Ljava/lang/Object;") \ No newline at end of file +CLASS_DESCRIPTOR("Ljava/lang/Object;") + +SIMPLE_NAME("method_with_spaces_20 a0 1680 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200a 202f 205f 3000 ")