Ejemplo n.º 1
0
        private Assignment ParseAssignment()
        {
            var tx = _stream.Fixate();

            var arg0 = ParsePrimary();

            if (arg0 == null)
            {
                return(null);
            }

            var t = NextToken();

            if (!t.IsOperator(Operator.Assign))
            {
                _stream.Rollback(tx); // Undo operator and 'primary' read

                return(null);
            }

            var node = new Assignment();

            node.AddChild(arg0);

            var arg1 = ParseExpression();

            node.AddChild(arg1);

            t = NextToken();
            AssertDelimiter(Delimiter.Semicolon, t);

            return(node);
        }