summaryrefslogtreecommitdiff
path: root/src/analysis/scan/grammar.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/grammar.y')
-rw-r--r--src/analysis/scan/grammar.y35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y
index 84eda7a..801898f 100644
--- a/src/analysis/scan/grammar.y
+++ b/src/analysis/scan/grammar.y
@@ -274,6 +274,7 @@ YY_DECL;
%type <pattern> hex_pattern
%type <node> hex_tokens
+%type <node> _hex_tokens
%type <node> hex_token
%type <node> hex_range
%type <node> hex_choices
@@ -726,14 +727,37 @@ YY_DECL;
}
;
- hex_tokens : hex_token
+ hex_tokens : _hex_tokens
+ {
+ $$ = $1;
+
+ if (G_IS_SCAN_TOKEN_NODE_SEQUENCE($$))
+ {
+ if (g_scan_token_node_sequence_count(G_SCAN_TOKEN_NODE_SEQUENCE($$)) == 1)
+ {
+ GScanTokenNode *node;
+
+ node = g_scan_token_node_sequence_get(G_SCAN_TOKEN_NODE_SEQUENCE($$), 0);
+
+ g_object_unref(G_OBJECT($$));
+
+ $$ = node;
+
+ }
+
+ }
+
+ }
+ ;
+
+ _hex_tokens : hex_token
{
if ($1 == NULL) YYERROR;
$$ = $1;
}
- | hex_tokens hex_token
+ | _hex_tokens hex_token
{
if ($2 == NULL) YYERROR;
@@ -793,7 +817,14 @@ YY_DECL;
}
| hex_range
{
+ if ($1 == NULL)
+ {
+ raise_error(_("Unable to build hexadecimal range"));
+ YYERROR;
+ }
+
$$ = $1;
+
}
| "~" hex_token
{