in client/src/lang/parser.ts [49:89]
private binary(isNested: boolean = false): CqlBinary {
if (this.peek().tokenType === TokenType.CHIP_VALUE)
throw new ParseError(
this.peek().start,
"I found an unexpected `:`. Did you intend to search for a field, e.g. `tag:news`? If you would like to add a search phrase containing a `:` character, please surround it in double quotes."
);
const left = this.expr();
if (isNested) {
this.guardAgainstCqlField("within a group");
}
const tokenType = this.peek().tokenType;
switch (tokenType) {
case TokenType.OR:
case TokenType.AND: {
this.consume(tokenType);
this.guardAgainstCqlField(`after \`${tokenType}\`.`);
if (this.isAtEnd()) {
throw this.error(
`There must be a query following \`${tokenType}\`, e.g. \`this ${tokenType} that\`.`
);
}
return new CqlBinary(left, {
operator: tokenType,
binary: this.binary(isNested),
});
}
case TokenType.RIGHT_BRACKET:
case TokenType.EOF: {
return new CqlBinary(left);
}
default: {
return new CqlBinary(left, {
operator: TokenType.OR,
binary: this.binary(isNested),
});
}
}
}