summaryrefslogtreecommitdiff
path: root/src/format/mangling/dex/type_gram.y
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_gram.y
parent3628caa2311ee89ad0d2a0aa2438d7e85b497da4 (diff)
Loaded all Dex pool items using several threads.
Diffstat (limited to 'src/format/mangling/dex/type_gram.y')
-rw-r--r--src/format/mangling/dex/type_gram.y32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/format/mangling/dex/type_gram.y b/src/format/mangling/dex/type_gram.y
index d5c3f26..506eb9b 100644
--- a/src/format/mangling/dex/type_gram.y
+++ b/src/format/mangling/dex/type_gram.y
@@ -7,10 +7,10 @@
#include "context.h"
#include "../context-int.h"
-
+typedef void *yyscan_t;
/* Affiche un message d'erreur concernant l'analyse. */
-static int type_error(GDexDemangler *, char *);
+static int type_error(GDexDemangler *, yyscan_t, char *);
/* Procède au décodage d'une chaîne de caractères. */
bool demangle_dex_type(GDexDemangler *, const char *);
@@ -36,7 +36,11 @@ bool demangle_dex_type(GDexDemangler *, const char *);
}
-%parse-param { GDexDemangler *demangler }
+
+%define api.pure full
+%parse-param { GDexDemangler *demangler } { yyscan_t scanner }
+%lex-param { yyscan_t scanner }
+
%token V Z B S C I J F D
%token ARRAY
@@ -55,9 +59,11 @@ bool demangle_dex_type(GDexDemangler *, const char *);
typedef struct yy_buffer_state *YY_BUFFER_STATE;
-extern YY_BUFFER_STATE type__scan_string(const char *);
-extern void type__delete_buffer(YY_BUFFER_STATE);
-extern int type_lex(void);
+extern int type_lex_init(yyscan_t *scanner);
+extern YY_BUFFER_STATE type__scan_string(const char *, yyscan_t);
+extern void type__delete_buffer(YY_BUFFER_STATE, yyscan_t);
+extern int type_lex(YYSTYPE *, yyscan_t);
+extern int type_lex_destroy(yyscan_t);
%}
@@ -104,6 +110,7 @@ simple_name:
/******************************************************************************
* *
* Paramètres : demangler = contexte associé à la procédure de décodage. *
+* scanner = données internes aux analyseurs. *
* msg = indications humaines sur l'événement. *
* *
* Description : Affiche un message d'erreur concernant l'analyse. *
@@ -113,7 +120,7 @@ simple_name:
* Remarques : - *
* *
******************************************************************************/
-static int type_error(GDexDemangler *demangler, char *msg)
+static int type_error(GDexDemangler *demangler, yyscan_t scanner, char *msg)
{
return -1;
@@ -135,12 +142,17 @@ static int type_error(GDexDemangler *demangler, char *msg)
bool demangle_dex_type(GDexDemangler *demangler, const char *desc)
{
+ yyscan_t scanner; /* Données internes */
YY_BUFFER_STATE buffer; /* Tampon pour bison */
int ret; /* Bilan de l'appel */
- buffer = type__scan_string(desc);
- ret = yyparse(demangler);
- type__delete_buffer(buffer);
+ type_lex_init(&scanner);
+
+ buffer = type__scan_string(desc, scanner);
+ ret = yyparse(demangler, scanner);
+ type__delete_buffer(buffer, scanner);
+
+ type_lex_destroy(scanner);
return (ret == 0);