[tracker/wip/carlosg/sparql-parser-ng: 278/306] libtracker-data: Accept Expression in BOUND()



commit 45aa7593fa0a987b18eb2db158589881ac473288
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Apr 1 20:52:26 2018 +0200

    libtracker-data: Accept Expression in BOUND()
    
    This is a syntax extension we used to accept, so bring it back.

 src/libtracker-data/tracker-sparql-grammar.h | 6 +++++-
 src/libtracker-data/tracker-sparql.c         | 9 +--------
 2 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-grammar.h b/src/libtracker-data/tracker-sparql-grammar.h
index 50c32afe7..4109cb75f 100644
--- a/src/libtracker-data/tracker-sparql-grammar.h
+++ b/src/libtracker-data/tracker-sparql-grammar.h
@@ -685,6 +685,10 @@ static const TrackerGrammarRule rule_RegexExpression[] = { L(REGEX), L(OPEN_PARE
  *                 | RegexExpression
  *                 | ExistsFunc
  *                 | NotExistsFunc
+ *
+ * TRACKER EXTENSION:
+ * BOUND accepts the more generic Expression rule, resulting in:
+ *    'BOUND' '(' Expression ')'
  */
 static const TrackerGrammarRule helper_BuiltInCall_seq_1[] = { L(OPEN_PARENS), R(Expression), 
L(CLOSE_PARENS), NIL };
 static const TrackerGrammarRule helper_BuiltInCall_or_1[] = { T(NIL), S(helper_BuiltInCall_seq_1), NIL };
@@ -692,7 +696,7 @@ static const TrackerGrammarRule helper_BuiltInCall_seq_2[] = { L(STR), S(helper_
 static const TrackerGrammarRule helper_BuiltInCall_seq_3[] = { L(LANG), S(helper_BuiltInCall_seq_1), NIL };
 static const TrackerGrammarRule helper_BuiltInCall_seq_4[] = { L(LANGMATCHES), L(OPEN_PARENS), 
R(Expression), L(COMMA), R(Expression), L(CLOSE_PARENS), NIL };
 static const TrackerGrammarRule helper_BuiltInCall_seq_5[] = { L(DATATYPE), S(helper_BuiltInCall_seq_1), NIL 
};
-static const TrackerGrammarRule helper_BuiltInCall_seq_6[] = { L(BOUND), L(OPEN_PARENS), R(Var), 
L(CLOSE_PARENS), NIL };
+static const TrackerGrammarRule helper_BuiltInCall_seq_6[] = { L(BOUND), L(OPEN_PARENS), R(Expression), 
L(CLOSE_PARENS), NIL };
 static const TrackerGrammarRule helper_BuiltInCall_seq_7[] = { L(IRI), S(helper_BuiltInCall_seq_1), NIL };
 static const TrackerGrammarRule helper_BuiltInCall_seq_8[] = { L(URI), S(helper_BuiltInCall_seq_1), NIL };
 static const TrackerGrammarRule helper_BuiltInCall_seq_9[] = { L(BNODE), OR(helper_BuiltInCall_or_1), NIL };
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index a6e766bc0..4107991de 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -5050,16 +5050,9 @@ translate_BuiltInCall (TrackerSparql  *sparql,
                _expect (sparql, RULE_TYPE_LITERAL, LITERAL_CLOSE_PARENS);
                _append_string (sparql, "ELSE NULL END ");
        } else if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_BOUND)) {
-               TrackerVariable *var;
-
                _expect (sparql, RULE_TYPE_LITERAL, LITERAL_OPEN_PARENS);
                _append_string (sparql, "(");
-               _call_rule (sparql, NAMED_RULE_Var, error);
-
-               var = _last_node_variable (sparql);
-               _append_string_printf (sparql, "%s ",
-                                      tracker_variable_get_sql_expression (var));
-
+               _call_rule (sparql, NAMED_RULE_Expression, error);
                _expect (sparql, RULE_TYPE_LITERAL, LITERAL_CLOSE_PARENS);
                _append_string (sparql, "IS NOT NULL) ");
                sparql->current_state.expression_type = TRACKER_PROPERTY_TYPE_BOOLEAN;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]