[tracker] SPARQL: Parse typed literals
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] SPARQL: Parse typed literals
- Date: Tue, 18 Aug 2009 08:51:13 +0000 (UTC)
commit f39a4d3e21e441a96ceaa45f7a4cf9fe04dc01b1
Author: Jürg Billeter <j bitron ch>
Date: Tue Aug 18 10:13:41 2009 +0200
SPARQL: Parse typed literals
src/libtracker-data/tracker-sparql-query.vala | 19 ++++++++++++++++++-
src/libtracker-data/tracker-sparql-scanner.vala | 8 ++++++++
2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index ef53fc3..4aa6204 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -1144,10 +1144,27 @@ public class Tracker.SparqlQuery : Object {
p++;
}
}
+
+ if (accept (SparqlTokenType.DOUBLE_CIRCUMFLEX)) {
+ if (!accept (SparqlTokenType.IRI_REF)) {
+ accept (SparqlTokenType.PN_PREFIX);
+ expect (SparqlTokenType.COLON);
+ }
+ }
+
return sb.str;
case SparqlTokenType.STRING_LITERAL_LONG1:
case SparqlTokenType.STRING_LITERAL_LONG2:
- return get_last_string (3);
+ string result = get_last_string (3);
+
+ if (accept (SparqlTokenType.DOUBLE_CIRCUMFLEX)) {
+ if (!accept (SparqlTokenType.IRI_REF)) {
+ accept (SparqlTokenType.PN_PREFIX);
+ expect (SparqlTokenType.COLON);
+ }
+ }
+
+ return result;
default:
throw new SparqlError.PARSE ("expected string literal \"%s\")", get_last_string ());
}
diff --git a/src/libtracker-data/tracker-sparql-scanner.vala b/src/libtracker-data/tracker-sparql-scanner.vala
index cbc5e5e..d729d11 100644
--- a/src/libtracker-data/tracker-sparql-scanner.vala
+++ b/src/libtracker-data/tracker-sparql-scanner.vala
@@ -667,6 +667,13 @@ public class Tracker.SparqlScanner : Object {
throw new SparqlError.PARSE ("%d.%d: syntax error, expected %c", line, column + token_length_in_chars, begin[0]);
}
break;
+ case '^':
+ type = SparqlTokenType.NONE;
+ if (current < end - 2 && current[0] == current[1]) {
+ type = SparqlTokenType.DOUBLE_CIRCUMFLEX;
+ current += 2;
+ }
+ break;
default:
unichar u = ((string) current).get_char_validated ((long) (end - current));
if (u != (unichar) (-1)) {
@@ -775,6 +782,7 @@ public enum Tracker.SparqlTokenType {
DIV,
DOT,
DOUBLE,
+ DOUBLE_CIRCUMFLEX,
DROP,
EOF,
FALSE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]