예제 #1
0
        protected virtual AssignmentNode ParseAssignment(SemanticNode parent, IdentifierToken identifier, AssignmentOperatorToken assignmentOperator)
        {
            // PARSE: <assignment> ::= <assignment target> assignmentOperator <expression>
            //      <assignment target> := identifier
            AssignmentNode result = new AssignmentNode(parent, identifier, assignmentOperator);

            Token          token      = this.GetNextTokenxx(Preference.NegativeSign);
            ExpressionNode expression = this.ParseExpression(result, token);

            if (expression == null)
            {
                this.ReportParserError(result, SemanticErrors.MissingExpression, token);
            }
            else
            {
                result.SetContents(expression);
            }

            return(result);
        }