[tracker/wip/carlosg/sparql-parser-ng: 286/306] libtracker-data: Make '; ' separator between updates optional again



commit 50966a269bb55a2443b05cbf45d201c0d2921364
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 31 12:24:43 2018 +0200

    libtracker-data: Make ';' separator between updates optional again
    
    This is a Tracker extension to the SPARQL1.1 syntax.

 src/libtracker-data/tracker-sparql-grammar.h | 6 +++++-
 src/libtracker-data/tracker-sparql.c         | 8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-grammar.h b/src/libtracker-data/tracker-sparql-grammar.h
index 4109cb75f..2ade748de 100644
--- a/src/libtracker-data/tracker-sparql-grammar.h
+++ b/src/libtracker-data/tracker-sparql-grammar.h
@@ -1451,8 +1451,12 @@ static const TrackerGrammarRule helper_Prologue_gte0[] = { OR(helper_Prologue_or
 static const TrackerGrammarRule rule_Prologue[] = { GTE0 (helper_Prologue_gte0), NIL };
 
 /* Update ::= Prologue ( Update1 ( ';' Update )? )?
+ *
+ * TRACKER EXTENSION:
+ * ';' separator is made optional.
  */
-static const TrackerGrammarRule helper_Update_seq_1[] = { L(SEMICOLON), R(Update), NIL };
+static const TrackerGrammarRule helper_Update_opt_3[] = { L(SEMICOLON), NIL };
+static const TrackerGrammarRule helper_Update_seq_1[] = { OPT(helper_Update_opt_3), R(Update), NIL };
 static const TrackerGrammarRule helper_Update_opt_1[] = { S (helper_Update_seq_1), NIL };
 static const TrackerGrammarRule helper_Update_seq_2[] = { R(Update1), OPT (helper_Update_opt_1), NIL };
 static const TrackerGrammarRule helper_Update_opt_2[] = { S(helper_Update_seq_2), NIL };
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 4998deeca..a7eac02e2 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -1647,6 +1647,9 @@ translate_Update (TrackerSparql  *sparql,
                   GError        **error)
 {
        /* Update ::= Prologue ( Update1 ( ';' Update )? )?
+        *
+        * TRACKER EXTENSION:
+        * ';' separator is made optional.
         */
        _call_rule (sparql, NAMED_RULE_Prologue, error);
 
@@ -1659,9 +1662,10 @@ translate_Update (TrackerSparql  *sparql,
                if (sparql->blank_nodes)
                        g_variant_builder_close (sparql->blank_nodes);
 
-               if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_SEMICOLON)) {
+               _accept (sparql, RULE_TYPE_LITERAL, LITERAL_SEMICOLON);
+
+               if (_check_in_rule (sparql, NAMED_RULE_Update))
                        _call_rule (sparql, NAMED_RULE_Update, error);
-               }
        }
 
        return TRUE;


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