Ejemplo n.º 1
0
        private TexlNode ParseParenExpr()
        {
            Contracts.Assert(_curs.TidCur == TokKind.ParenOpen);

            var open   = _curs.TokMove();
            var before = ParseTrivia();

            // SingleExpr here means we don't want chains, but individual expressions.
            TexlNode node  = ParseExpr(Precedence.SingleExpr);
            var      after = ParseTrivia();
            var      close = TokEat(TokKind.ParenClose);

            var sources = new List <ITexlSource>
            {
                new TokenSource(open),
                before,
                new SpreadSource(node.SourceList.Sources),
                after
            };

            if (close != null)
            {
                sources.Add(new TokenSource(close));
            }

            node.Parser_SetSourceList(new SourceList(new SpreadSource(sources)));
            return(node);
        }