summaryrefslogtreecommitdiff
path: root/src/format/mangling/dex/type_tok.l
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-09 11:57:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-09 11:57:58 (GMT)
commit0b6e87de0d4313f8ef31907bc48ce4d7f7749738 (patch)
treef268e98efa733379b275d8834864f13cff6fa9ac /src/format/mangling/dex/type_tok.l
parent3628caa2311ee89ad0d2a0aa2438d7e85b497da4 (diff)
Loaded all Dex pool items using several threads.
Diffstat (limited to 'src/format/mangling/dex/type_tok.l')
-rw-r--r--src/format/mangling/dex/type_tok.l32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/format/mangling/dex/type_tok.l b/src/format/mangling/dex/type_tok.l
index 9c24085..918846a 100644
--- a/src/format/mangling/dex/type_tok.l
+++ b/src/format/mangling/dex/type_tok.l
@@ -4,13 +4,17 @@
#include "context.h"
#include "libformatmanglingdextype_la-type_gram.h"
+/* See lemoda.net/c/reentrant-parser */
+
%}
%option noyywrap
%option yylineno
%option nounput
- /*%option noinput*/
+/*%option noinput*/
+%option reentrant
+%option bison-bridge
%x string
@@ -29,11 +33,11 @@ SIMPLE {ASCII}|"$"|"-"|"_"
"F" { return F; }
"D" { return D; }
"L" { BEGIN(string); return L; }
-"["* { type_lval.adeep = strlen(yytext); return ARRAY; }
+"["* { yylval->adeep = strlen(yytext); return ARRAY; }
<string>"/" { return SLASH; }
<string>";" { BEGIN(INITIAL); return SEMICOLON; }
-<string>{SIMPLE}* { type_lval.text = yytext; return TEXT; }
+<string>{SIMPLE}* { yylval->text = yytext; return TEXT; }
<string>. {
unsigned char next;
@@ -44,7 +48,7 @@ SIMPLE {ASCII}|"$"|"-"|"_"
/* U+00a1 ... U+1fff */
case 0x00 ... 0x1f:
- next = input();
+ next = input(yyscanner);
if (yytext[0] == 0x00 && next < 0xa1)
{
@@ -57,7 +61,7 @@ SIMPLE {ASCII}|"$"|"-"|"_"
mutf8[1] = next;
mutf8[2] = '\0';
- strcpy(type_lval.text, mutf8); return TEXT;
+ strcpy(yylval->text, mutf8); return TEXT;
}
@@ -66,7 +70,7 @@ SIMPLE {ASCII}|"$"|"-"|"_"
/* U+2010 ... U+2027 / U+2030 ... U+d7ff */
case 0x20:
- next = input();
+ next = input(yyscanner);
switch (next)
{
@@ -77,7 +81,7 @@ SIMPLE {ASCII}|"$"|"-"|"_"
mutf8[1] = next;
mutf8[2] = '\0';
- strcpy(type_lval.text, mutf8); return TEXT;
+ strcpy(yylval->text, mutf8); return TEXT;
break;
default:
@@ -91,19 +95,19 @@ SIMPLE {ASCII}|"$"|"-"|"_"
/* ~ U+2030 ... U+d7ff */
case 0x21 ... 0xd7:
- next = input();
+ next = input(yyscanner);
mutf8[0] = yytext[0];
mutf8[1] = next;
mutf8[2] = '\0';
- strcpy(type_lval.text, mutf8); return TEXT;
+ strcpy(yylval->text, mutf8); return TEXT;
break;
/* U+e000 ... U+ffef */
case 0xe0 ... 0xff:
- next = input();
+ next = input(yyscanner);
if (yytext[0] == 0xff && next > 0xef)
{
@@ -116,7 +120,7 @@ SIMPLE {ASCII}|"$"|"-"|"_"
mutf8[1] = next;
mutf8[2] = '\0';
- strcpy(type_lval.text, mutf8); return TEXT;
+ strcpy(yylval->text, mutf8); return TEXT;
}
@@ -127,11 +131,11 @@ SIMPLE {ASCII}|"$"|"-"|"_"
case 0x10:
mutf8[0] = yytext[0];
- mutf8[1] = input();
- mutf8[2] = input();
+ mutf8[1] = input(yyscanner);
+ mutf8[2] = input(yyscanner);
mutf8[3] = '\0';
- strcpy(type_lval.text, mutf8); return TEXT;
+ strcpy(yylval->text, mutf8); return TEXT;
break;
*/