[tracker/parser] SPARQL: Add type information for unary expressions
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/parser] SPARQL: Add type information for unary expressions
- Date: Wed, 12 Aug 2009 11:23:58 +0000 (UTC)
commit d6a4c544da9ce44789e63d702de475158dd3597a
Author: Jürg Billeter <j bitron ch>
Date: Wed Aug 12 13:16:34 2009 +0200
SPARQL: Add type information for unary expressions
src/libtracker-data/tracker-sparql-query.vala | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 9f093ba..ea6cb32 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -1208,22 +1208,24 @@ public class Tracker.SparqlQuery : Object {
}
}
- void translate_unary_expression (StringBuilder sql) throws SparqlError {
+ DataType translate_unary_expression (StringBuilder sql) throws SparqlError {
if (accept (SparqlTokenType.OP_NEG)) {
sql.append ("NOT (");
- translate_primary_expression (sql);
+ var optype = translate_primary_expression (sql);
sql.append (")");
- return;
+ if (optype != DataType.BOOLEAN) {
+ throw new SparqlError.PARSE ("expected boolean expression");
+ }
+ return DataType.BOOLEAN;
} else if (accept (SparqlTokenType.PLUS)) {
- translate_primary_expression (sql);
- return;
+ return translate_primary_expression (sql);
} else if (accept (SparqlTokenType.MINUS)) {
sql.append ("-(");
- translate_primary_expression (sql);
+ var optype = translate_primary_expression (sql);
sql.append (")");
- return;
+ return optype;
}
- translate_primary_expression (sql);
+ return translate_primary_expression (sql);
}
void translate_multiplicative_expression (StringBuilder sql) throws SparqlError {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]