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.y129
1 files changed, 113 insertions, 16 deletions
diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y
index f31a5d1..ecaeb1f 100644
--- a/src/analysis/scan/grammar.y
+++ b/src/analysis/scan/grammar.y
@@ -331,7 +331,11 @@ YY_DECL;
rules : /* empty */
| external rules
- | rule rules { g_content_scanner_add_rule(scanner, $1); }
+ | rule rules
+ {
+ g_content_scanner_add_rule(scanner, $1);
+ g_object_unref(G_OBJECT($1));
+ }
;
@@ -538,9 +542,11 @@ YY_DECL;
{
$$ = g_scan_modifier_pipe_new();
g_scan_modifier_pipe_add(G_SCAN_MODIFIER_PIPE($$), $1);
+ g_object_unref(G_OBJECT($1));
}
g_scan_modifier_pipe_add(G_SCAN_MODIFIER_PIPE($$), $3);
+ g_object_unref(G_OBJECT($3));
}
;
@@ -575,6 +581,7 @@ YY_DECL;
{
$$ = g_scan_modifier_list_new();
g_scan_modifier_list_add(G_SCAN_MODIFIER_LIST($$), $1);
+ g_object_unref(G_OBJECT($1));
}
status = g_scan_modifier_list_add(G_SCAN_MODIFIER_LIST($$), $2);
@@ -582,9 +589,10 @@ YY_DECL;
{
if (1)
log_simple_message(LMT_WARNING, "modifier already taken into account!");
- g_object_unref(G_OBJECT($2));
}
+ g_object_unref(G_OBJECT($2));
+
}
;
@@ -634,6 +642,9 @@ YY_DECL;
}
_status = g_scan_token_customizer_attach_modifier(G_SCAN_TOKEN_CUSTOMIZER($$), _mod);
+
+ g_object_unref(G_OBJECT(_mod));
+
if (!_status)
{
char *_msg;
@@ -1065,6 +1076,7 @@ YY_DECL;
| chain_items "." chain_item
{
g_scan_named_access_attach_next(G_SCAN_NAMED_ACCESS($1), G_SCAN_NAMED_ACCESS($3));
+ g_object_unref(G_OBJECT($3));
$$ = $1;
}
;
@@ -1107,58 +1119,143 @@ YY_DECL;
}
;
- logical_expr : cexpression "and" cexpression { $$ = g_scan_logical_operation_new(BOT_AND, $1, $3); }
- | cexpression "or" cexpression { $$ = g_scan_logical_operation_new(BOT_OR, $1, $3); }
- | "not" "(" cexpression ")" { $$ = g_scan_logical_operation_new(BOT_NOT, $3, NULL); }
+ logical_expr : cexpression "and" cexpression
+ {
+ $$ = g_scan_logical_operation_new(BOT_AND, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "or" cexpression
+ {
+ $$ = g_scan_logical_operation_new(BOT_OR, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | "not" "(" cexpression ")"
+ {
+ $$ = g_scan_logical_operation_new(BOT_NOT, $3, NULL);
+ g_object_unref(G_OBJECT($3));
+ }
;
-relational_expr : cexpression "<" cexpression { $$ = g_scan_relational_operation_new(RCO_LT, $1, $3); }
- | cexpression "<=" cexpression { $$ = g_scan_relational_operation_new(RCO_LE, $1, $3); }
- | cexpression "==" cexpression { $$ = g_scan_relational_operation_new(RCO_EQ, $1, $3); }
- | cexpression "!=" cexpression { $$ = g_scan_relational_operation_new(RCO_NE, $1, $3); }
- | cexpression ">" cexpression { $$ = g_scan_relational_operation_new(RCO_GT, $1, $3); }
- | cexpression ">=" cexpression { $$ = g_scan_relational_operation_new(RCO_GE, $1, $3); }
+relational_expr : cexpression "<" cexpression
+ {
+ $$ = g_scan_relational_operation_new(RCO_LT, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "<=" cexpression
+ {
+ $$ = g_scan_relational_operation_new(RCO_LE, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "==" cexpression
+ {
+ $$ = g_scan_relational_operation_new(RCO_EQ, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "!=" cexpression
+ {
+ $$ = g_scan_relational_operation_new(RCO_NE, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression ">" cexpression
+ {
+ $$ = g_scan_relational_operation_new(RCO_GT, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression ">=" cexpression
+ {
+ $$ = g_scan_relational_operation_new(RCO_GE, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
;
string_op : cexpression "contains" cexpression
{
$$ = g_scan_string_operation_new(SOT_CONTAINS, $1, $3, true);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "startswith" cexpression
{
$$ = g_scan_string_operation_new(SOT_STARTSWITH, $1, $3, true);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "endswith" cexpression
{
$$ = g_scan_string_operation_new(SOT_ENDSWITH, $1, $3, true);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "matches" cexpression
{
$$ = g_scan_string_operation_new(SOT_MATCHES, $1, $3, true);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "icontains" cexpression
{
$$ = g_scan_string_operation_new(SOT_CONTAINS, $1, $3, false);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "istartswith" cexpression
{
$$ = g_scan_string_operation_new(SOT_STARTSWITH, $1, $3, false);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "iendswith" cexpression
{
$$ = g_scan_string_operation_new(SOT_ENDSWITH, $1, $3, false);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
| cexpression "iequals" cexpression
{
$$ = g_scan_string_operation_new(SOT_IEQUALS, $1, $3, false);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
}
;
- arithm_expr : cexpression "+" cexpression { $$ = g_scan_arithmetic_operation_new(AEO_PLUS, $1, $3); }
- | cexpression "-" cexpression { $$ = g_scan_arithmetic_operation_new(AEO_MINUS, $1, $3); }
- | cexpression "*" cexpression { $$ = g_scan_arithmetic_operation_new(AEO_MUL, $1, $3); }
- | cexpression "/" cexpression { $$ = g_scan_arithmetic_operation_new(AEO_DIV, $1, $3); }
- | cexpression "%" cexpression { $$ = g_scan_arithmetic_operation_new(AEO_MOD, $1, $3); }
+ arithm_expr : cexpression "+" cexpression
+ {
+ $$ = g_scan_arithmetic_operation_new(AEO_PLUS, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "-" cexpression
+ {
+ $$ = g_scan_arithmetic_operation_new(AEO_MINUS, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "*" cexpression
+ {
+ $$ = g_scan_arithmetic_operation_new(AEO_MUL, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "/" cexpression
+ {
+ $$ = g_scan_arithmetic_operation_new(AEO_DIV, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
+ | cexpression "%" cexpression
+ {
+ $$ = g_scan_arithmetic_operation_new(AEO_MOD, $1, $3);
+ g_object_unref(G_OBJECT($1));
+ g_object_unref(G_OBJECT($3));
+ }
;