private static ExpressionBase ParseConditional(PositionalTokenizer tokenizer, ExpressionBase left, ConditionalOperation operation, int joinerLine, int joinerColumn) { OperationPriority priority; switch (operation) { case ConditionalOperation.And: priority = OperationPriority.And; break; case ConditionalOperation.Or: priority = OperationPriority.Or; break; case ConditionalOperation.Not: priority = OperationPriority.Not; break; default: return(new ParseErrorExpression("Unknown operation: " + operation)); } var right = ParseExpression(tokenizer, priority); switch (right.Type) { case ExpressionType.ParseError: return(right); case ExpressionType.BooleanConstant: case ExpressionType.Comparison: case ExpressionType.Conditional: case ExpressionType.FunctionCall: case ExpressionType.Variable: break; default: var expressionTokenizer = tokenizer as ExpressionTokenizer; if (expressionTokenizer != null) { expressionTokenizer.QueueExpression(right); } right = new KeywordExpression(ConditionalExpression.GetOperatorString(operation), joinerLine, joinerColumn); return(ParseError(tokenizer, "Incompatible logical condition", right)); } return(new ConditionalExpression(left, operation, right)); }
private static ExpressionBase ParseConditional(PositionalTokenizer tokenizer, ExpressionBase left, ConditionalOperation operation, int joinerLine, int joinerColumn) { var right = ExpressionBase.Parse(tokenizer); switch (right.Type) { case ExpressionType.ParseError: return(right); case ExpressionType.Comparison: case ExpressionType.Conditional: case ExpressionType.FunctionCall: case ExpressionType.Variable: break; default: ParseError(tokenizer, "incompatible logical condition", new KeywordExpression(ConditionalExpression.GetOperatorString(operation), joinerLine, joinerColumn)); break; } return(new ConditionalExpression(left, operation, right)); }