Permalink
Browse files

Parser-Tests and fixes

  • Loading branch information...
Jon
Jon committed May 30, 2012
1 parent 37885dd commit a43da0427d3de3c34a9a2c26bd0c9c652e3919c8
@@ -83,7 +83,7 @@
put(TokenTypes.V, "V");
put(TokenTypes.WHERE, "where");
put(TokenTypes.WITH, "with");
- put(TokenTypes.NESTED, "nested");
+ put(TokenTypes.NESTED, "subgraph");
put(TokenTypes.LOCAL, "local");
put(TokenTypes.PARTIAL, "partial");
put(TokenTypes.KAPPA, "kappa");
@@ -348,7 +348,8 @@ private final String matchIdentifier() {
}
private final String matchSimpleName() {
- if (lookAhead(0) == TokenTypes.IDENTIFIER) {
+ if (lookAhead(0) == TokenTypes.IDENTIFIER
+ || lookAhead(0) == TokenTypes.V || lookAhead(0) == TokenTypes.E) {
String name = lookAhead.getValue();
if (isValidSimpleName(name)) {
match();
@@ -524,7 +525,8 @@ private final void parseQuery() {
Identifier ident = graph.createIdentifier();
offset = getCurrentOffset();
ident.set_name(matchIdentifier());
- IsIdOfStoreClause isId = graph.createIsIdOfStoreClause(ident, rootExpr);
+ IsIdOfStoreClause isId = graph.createIsIdOfStoreClause(ident,
+ rootExpr);
isId.set_sourcePositions(createSourcePositionList(offset));
}
match(TokenTypes.EOF);
@@ -702,6 +704,7 @@ private final PartialSubgraphDefinition parsePartialSubgraphDefinition() {
.createIsIdOfPartialGraphDefinition(id,
partialDefinition);
}
+ match(TokenTypes.RPAREN);
} else {
fail("Expected opening parenthesis, but found:");
}
@@ -733,6 +736,7 @@ private final NestedSubgraphDefinition parseNestedSubgraphDefinition() {
} else {
fail("No identifier in nested-definition:");
}
+ match(TokenTypes.RPAREN);
} else {
fail("No opening parenthesis in nested-definition:");
}
@@ -1701,6 +1705,8 @@ private final PrimaryPathDescription parseSimpleIncidencePathDescription() {
dir = graph.createIncidenceDirection();
dir.set_dir(direction);
}
+ graph.createIsIncDirectionOf(dir, result);
+
}
// A LCURLY after an Incidence-arrow can be either an
// IncidenceRestriction (restriction of the incidence itself) or an
@@ -1712,6 +1718,7 @@ private final PrimaryPathDescription parseSimpleIncidencePathDescription() {
try {
match(TokenTypes.LCURLY);
parseTypeExpressionList();
+ match(TokenTypes.RCURLY);
} catch (ParsingException ex) {
}
if (predicateEnd()) {
@@ -1844,7 +1851,9 @@ private ElementRestriction parseElementSetRestriction() {
}
private ElementRestriction parseTypeRestriction(RestrictionType rType) {
- List<VertexPosition<TypeId>> typeList = parseTypeExpressionList();
+ List<VertexPosition<TypeId>> typeList = new ArrayList<VertexPosition<TypeId>>();
+
+ typeList = parseTypeExpressionList();
if (!inPredicateMode()) {
if (typeList != null && typeList.size() > 0) {
ElementTypeRestriction typeRestriction = graph
@@ -2360,6 +2369,7 @@ private final Expression parseRangeExpression() {
private final List<VertexPosition<TypeId>> parseTypeExpressionList() {
List<VertexPosition<TypeId>> list = new ArrayList<VertexPosition<TypeId>>();
+
do {
int offset = getCurrentOffset();
TypeId t = parseTypeId();
Oops, something went wrong.

0 comments on commit a43da04

Please sign in to comment.