[tracker/wip/carlosg/more-sparql-fixes: 5/9] libtracker-data: Try STRING_LITERAL_LONG1/2 before STRING_LITERAL1/2




commit d73e7af75dca912f3da1ec26898e6b44fa7e3799
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 24 11:02:30 2022 +0100

    libtracker-data: Try STRING_LITERAL_LONG1/2 before STRING_LITERAL1/2
    
    As our parser rules are ordered by greediness, and as """str""" and
    '''str''' long string forms partially match the shorter string literal
    forms, we mistakenly parse these as an empty string (e.g. "" or '')
    followed by "garbage".
    
    We should set long string literal forms first here, so these are tried
    before the short string forms. Fixes handling of long strings all through
    the query language.

 src/libtracker-data/tracker-sparql-grammar.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-sparql-grammar.h b/src/libtracker-data/tracker-sparql-grammar.h
index 8835539ad..673c39721 100644
--- a/src/libtracker-data/tracker-sparql-grammar.h
+++ b/src/libtracker-data/tracker-sparql-grammar.h
@@ -556,7 +556,7 @@ static const TrackerGrammarRule rule_iri[] = { OR(helper_iri_or), NIL };
  * TRACKER EXTENSION:
  * The terminal PARAMETERIZED_VAR is additionally accepted
  */
-static const TrackerGrammarRule helper_String_or[] = { T(STRING_LITERAL1), T(STRING_LITERAL2), 
T(STRING_LITERAL_LONG1), T(STRING_LITERAL_LONG2), T(PARAMETERIZED_VAR), NIL };
+static const TrackerGrammarRule helper_String_or[] = { T(STRING_LITERAL_LONG1), T(STRING_LITERAL_LONG2), 
T(STRING_LITERAL1), T(STRING_LITERAL2), T(PARAMETERIZED_VAR), NIL };
 static const TrackerGrammarRule rule_String[] = { OR(helper_String_or), NIL };
 
 /* BooleanLiteral ::= 'true' | 'false'


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