C# Class Microsoft.R.Core.AST.Expressions.Expression

Implements shunting yard algorithm of expression parsing. https://en.wikipedia.org/wiki/Shunting-yard_algorithm
Mostrar archivo Open project: Microsoft/RTVS Class Usage Examples

Public Methods

Method Description
Expression ( bool inGroup ) : System.Diagnostics

Constructs an expression that will be parsed as it is inside braces (in a group) so expression parsing will continue even if there is a line break that would normally terminate the expression.

Expression ( string terminatingKeyword ) : System.Diagnostics
Parse ( ParseContext context, IAstNode parent ) : bool
ToString ( ) : string

Private Methods

Method Description
CheckEndOfExpression ( ParseContext context, OperationType currentOperationType ) : bool
CreateConstant ( ParseContext context ) : IRValueNode
GetErrorRange ( ParseContext context ) : ITextRange
GetIndexerOrFunctionErrorRange ( ParseContext context, IOperator operatorNode ) : ITextRange
GetOperandErrorRange ( ParseContext context ) : ITextRange
GetOperatorErrorRange ( ParseContext context ) : ITextRange
HandleConstant ( ParseContext context ) : OperationType
HandleIdentifier ( ParseContext context ) : OperationType
HandleKeyword ( ParseContext context, ParseErrorType &errorType ) : OperationType
HandleKeyword ( ParseContext context, string keyword ) : ParseErrorType
HandleLambda ( ParseContext context, ParseErrorType &errorType ) : OperationType
HandleOpenBrace ( ParseContext context, ParseErrorType &errorType ) : OperationType
HandleOperator ( ParseContext context, ParseErrorType &errorType ) : OperationType
HandleOperator ( ParseContext context, IAstNode parent, bool &isUnary ) : ParseErrorType
HandleOperatorPrecedence ( ParseContext context, IOperator currentOperator ) : ParseErrorType
HandleSquareBrackets ( ParseContext context, ParseErrorType &errorType ) : OperationType
IsConsistentOperationSequence ( ParseContext context, OperationType currentOperationType ) : bool
IsTerminatingKeyword ( string s ) : bool
MakeNode ( ParseContext context ) : ParseErrorType

Constructs AST node from operator (root) and one or two operands. In order for the node to be successfully created stacks must contain an operator and, depending on the operator, one or two operands.

ParseExpression ( ParseContext context ) : bool
ProcessHigherPrecendenceOperators ( ParseContext context, IOperator currentOperator ) : ParseErrorType
SafeGetLeftOperand ( IOperator operatorNode ) : IRValueNode
SafeGetOperand ( IOperator operatorNode ) : IRValueNode
SafeGetRightOperand ( IOperator operatorNode ) : IRValueNode

Method Details

Expression() public method

Constructs an expression that will be parsed as it is inside braces (in a group) so expression parsing will continue even if there is a line break that would normally terminate the expression.
public Expression ( bool inGroup ) : System.Diagnostics
inGroup bool
return System.Diagnostics

Expression() public method

public Expression ( string terminatingKeyword ) : System.Diagnostics
terminatingKeyword string
return System.Diagnostics

Parse() public method

public Parse ( ParseContext context, IAstNode parent ) : bool
context Microsoft.R.Core.Parser.ParseContext
parent IAstNode
return bool

ToString() public method

public ToString ( ) : string
return string