This is the class used for the operator that seperated various arguments in round brackets.
Inheritance: BinaryOperator
Exemplo n.º 1
0
        public override Expression Scan(ParseEngine engine)
        {
            var start = engine.Pointer;
            var chars = engine.Characters;

            if (chars[start] == '(')
            {
                var index     = start;
                var line      = engine.CurrentLine;
                var col       = engine.CurrentColumn;
                var container = engine.Advance().ParseStatement(')', e => new YAMPBracketNotClosedError(line, col), (ch, statement) =>
                {
                    if (ch == ',')
                    {
                        var op = new CommaOperator(engine);
                        engine.Advance();
                        statement.Push(engine, op);
                        return(true);
                    }

                    return(false);
                }).Container;

                var exp = new BracketExpression(line, col, engine.Pointer - start, engine.Query, container ?? new ContainerExpression());

                if (container == null)
                {
                    engine.AddError(new YAMPBracketEmptyError(line, col), exp);
                }

                return(exp);
            }

            return(null);
        }
Exemplo n.º 2
0
        public override Expression Scan(ParseEngine engine)
        {
            var start = engine.Pointer;
            var chars = engine.Characters;

            if (chars[start] == '(')
            {
                var index = start;
                var line = engine.CurrentLine;
                var col = engine.CurrentColumn;
                var container = engine.Advance().ParseStatement(')', e => new YAMPBracketNotClosedError(line, col), (ch, statement) =>
                {
                    if (ch == ',')
                    {
                        var op = new CommaOperator(engine);
                        engine.Advance();
                        statement.Push(engine, op);
                        return true;
                    }

                    return false;
                }).Container;

                var exp = new BracketExpression(line, col, engine.Pointer - start, engine.Query, container ?? new ContainerExpression());

                if (container == null)
                {
                    engine.AddError(new YAMPBracketEmptyError(line, col), exp);
                }

                return exp;
            }

            return null;
        }