summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/analysis/scan/core.c2
-rw-r--r--src/analysis/scan/grammar.y33
2 files changed, 31 insertions, 4 deletions
diff --git a/src/analysis/scan/core.c b/src/analysis/scan/core.c
index 0b2c1d5..da3cf00 100644
--- a/src/analysis/scan/core.c
+++ b/src/analysis/scan/core.c
@@ -304,8 +304,6 @@ bool populate_main_scan_namespace(GScanNamespace *space)
ns = g_scan_namespace_new("string");
result = g_scan_namespace_register_item(space, G_REGISTERED_ITEM(ns));
- printf("g_scan_string_to_int_function_new(): %p\n", g_scan_string_to_int_function_new());
-
if (result) result = REGISTER_FUNC(ns, g_scan_string_lower_function_new());
if (result) result = REGISTER_FUNC(ns, g_scan_string_to_int_function_new());
if (result) result = REGISTER_FUNC(ns, g_scan_string_upper_function_new());
diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y
index 66d3f87..70382cf 100644
--- a/src/analysis/scan/grammar.y
+++ b/src/analysis/scan/grammar.y
@@ -8,6 +8,9 @@
/* Affiche un message d'erreur suite à l'analyse en échec. */
static int yyerror(GContentScanner *, yyscan_t, GScanRule **, sized_string_t *, sized_string_t *, void/*GBytesPattern*/ **, char **, size_t *, size_t *, char *);
+#define raise_error(msg) \
+ yyerror(scanner, yyscanner, built_rule, tmp_0, tmp_1, NULL, buf, allocated, used, msg)
+
%}
@@ -17,6 +20,10 @@ static int yyerror(GContentScanner *, yyscan_t, GScanRule **, sized_string_t *,
typedef void *yyscan_t;
#include <assert.h>
+#include <malloc.h>
+#include <stdio.h>
+
+#include <i18n.h>
#include "core.h"
#include "scanner.h"
@@ -372,6 +379,7 @@ YY_DECL;
*/
strings : /* empty */
+ | STRINGS COLON
| STRINGS COLON bytes_decls
;
@@ -388,6 +396,9 @@ YY_DECL;
g_object_unref(G_OBJECT($1));
}
| regex_pattern
+ {
+ // TODO
+ }
| bytes_decls str_pattern
{
if ($2 == NULL) YYERROR;
@@ -401,6 +412,9 @@ YY_DECL;
g_object_unref(G_OBJECT($2));
}
| bytes_decls regex_pattern
+ {
+ // TODO
+ }
;
@@ -445,8 +459,9 @@ YY_DECL;
}
| _modifiers
{
+ $$ = $1;
- // if (...) useless
+ // if (...) useless
}
;
@@ -494,7 +509,21 @@ YY_DECL;
modifier : NAME
{
$$ = find_scan_token_modifiers_for_name($1.data);
- if ($$ == NULL) YYERROR;
+ if ($$ == NULL)
+ {
+ char *_msg;
+ int _ret;
+
+ _ret = asprintf(&_msg, _("unknown modifier: \"%s\""), $1.data);
+
+ if (_ret != -1)
+ {
+ raise_error(_msg);
+ free(_msg);
+ }
+
+ YYERROR;
+ }
}
| "(" chained_modifiers ")"
{