[tracker/subqueries-for-master: 1/3] SPARQL: Support bracketted expressions as select expressions



commit b308caeb7e8840405fedb8aaef5261c4e9b435fa
Author: Jürg Billeter <j bitron ch>
Date:   Tue Dec 8 11:53:52 2009 +0100

    SPARQL: Support bracketted expressions as select expressions

 src/libtracker-data/tracker-sparql-query.vala |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index abd6ffd..40c00de 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -555,9 +555,32 @@ public class Tracker.SparqlQuery : Object {
 		return stmt.execute ();
 	}
 
+	void skip_bracketted_expression () throws SparqlError {
+		expect (SparqlTokenType.OPEN_PARENS);
+		while (true) {
+			switch (current ()) {
+			case SparqlTokenType.OPEN_PARENS:
+				// skip nested bracketted expression
+				skip_bracketted_expression ();
+				continue;
+			case SparqlTokenType.CLOSE_PARENS:
+			case SparqlTokenType.EOF:
+				break;
+			default:
+				next ();
+				continue;
+			}
+			break;
+		}
+		expect (SparqlTokenType.CLOSE_PARENS);
+	}
+
 	void skip_select_variables () throws SparqlError {
 		while (true) {
 			switch (current ()) {
+			case SparqlTokenType.OPEN_PARENS:
+				skip_bracketted_expression ();
+				continue;
 			case SparqlTokenType.FROM:
 			case SparqlTokenType.WHERE:
 			case SparqlTokenType.OPEN_BRACE:



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