public WhenConstructed() { this.node = new SingleValuePropertyAccessNode(this.propertyName); }
private SingleValueNode ParseSingleValuePropertyAccess() { SingleValueNode result = null; SingleValueNode leftNode = null; BinaryOperatorKind operatorKind = BinaryOperatorKind.None; SingleValueNode rightNode = null; while (this.tokens.Count > 0) { var token = this.tokens.Dequeue(); switch (token.TokenType) { case TokenType.ArithmeticOperator: case TokenType.LogicalOperator: if (operatorKind != BinaryOperatorKind.None) { result = new BinaryOperatorNode(leftNode, operatorKind, rightNode); leftNode = null; rightNode = null; } operatorKind = BinaryOperatorKindParser.ToBinaryOperatorKind(token.Value); break; case TokenType.OpenParentheses: this.groupingDepth++; break; case TokenType.CloseParentheses: this.groupingDepth--; break; case TokenType.FunctionName: if (leftNode == null) { leftNode = new SingleValueFunctionCallNode(token.Value); } else if (rightNode == null) { rightNode = new SingleValueFunctionCallNode(token.Value); } break; case TokenType.PropertyName: if (leftNode == null) { leftNode = new SingleValuePropertyAccessNode(token.Value); } else if (rightNode == null) { rightNode = new SingleValuePropertyAccessNode(token.Value); } break; case TokenType.Decimal: case TokenType.Double: case TokenType.False: case TokenType.Single: case TokenType.Int32: case TokenType.Int64: case TokenType.DateTime: case TokenType.DateTimeOffset: case TokenType.Guid: case TokenType.String: case TokenType.Null: case TokenType.Time: case TokenType.True: rightNode = ConstantNodeParser.ParseConstantNode(token); break; } } result = result == null ? new BinaryOperatorNode(leftNode, operatorKind, rightNode) : new BinaryOperatorNode(result, operatorKind, leftNode ?? rightNode); return result; }
/// <summary> /// Binds the specified <see cref="SingleValuePropertyAccessNode"/>. /// </summary> /// <param name="singleValuePropertyAccessNode">The <see cref="SingleValuePropertyAccessNode"/> to bind.</param> protected abstract void BindSingleValuePropertyAccessNode(SingleValuePropertyAccessNode singleValuePropertyAccessNode);