added ancestor

This commit is contained in:
zadam
2020-05-23 23:44:55 +02:00
parent 8ce2afff8a
commit 9ede77aead
5 changed files with 132 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ const AndExp = require('./expressions/and');
const OrExp = require('./expressions/or');
const NotExp = require('./expressions/not');
const ChildOfExp = require('./expressions/child_of');
const DescendantOfExp = require('./expressions/descendant_of');
const ParentOfExp = require('./expressions/parent_of');
const RelationWhereExp = require('./expressions/relation_where');
const PropertyComparisonExp = require('./expressions/property_comparison');
@@ -64,6 +65,12 @@ function getExpression(tokens, parsingContext) {
return new ParentOfExp(parseNoteProperty());
}
if (tokens[i] === 'ancestors') {
i += 1;
return new DescendantOfExp(parseNoteProperty());
}
if (tokens[i] === 'labels') {
if (tokens[i + 1] !== '.') {
parsingContext.addError(`Expected "." to separate field path, god "${tokens[i + 1]}"`);