Microsoft.R.Components.Application.Configuration.Parser.ConfigurationParser.ParseAssignment C# (CSharp) Method

ParseAssignment() private method

private ParseAssignment ( string text, IRValueNode &leftOperand, IRValueNode &rightOperand ) : bool
text string
leftOperand IRValueNode
rightOperand IRValueNode
return bool
        private bool ParseAssignment(string text, out IRValueNode leftOperand, out IRValueNode rightOperand) {
            leftOperand = null;
            rightOperand = null;

            // Parse the expression
            var ast = RParser.Parse(text);
            if (ast.Errors.Count == 0) {
                // Expected 'Variable <- Expression'
                var scope = ast.Children[0] as GlobalScope;
                if (scope?.Children.Count > 0) {
                    var exp = (scope.Children[0] as IExpressionStatement)?.Expression;
                    if (exp?.Children.Count == 1) {
                        var op = exp.Children[0] as IOperator;
                        if (op != null) {
                            if (op.OperatorType == OperatorType.LeftAssign && op.LeftOperand != null && op.RightOperand != null) {
                                leftOperand = op.LeftOperand;
                                rightOperand = op.RightOperand;
                                return true;
                            }
                        }
                    }
                }
            }
            return false;
        }