示例#1
0
 public override void Visit(SliceExpr expr)
 {
     if (expr.Target == null)
     {
         _needsAsync = true;
     }
 }
示例#2
0
        private Expr ParseIndexExpr(Expr prev)
        {
            var openBracket = Match("[");
            var next        = GetToken();

            Expr projectionFilter = null;

            if (next.Kind == "STRING" && GetToken(1).Kind == "]")
            {
                Match("STRING");
                Match("]");
                projectionFilter = new KeyExpr(GetLocation(next), prev, next.Text);
            }
            else if (next.Kind == "..")
            {
                Match("..");

                next = GetToken();
                if (next.Kind == "]")
                {
                    Match("]");
                    projectionFilter = new SliceExpr(GetLocation(openBracket), prev, null, null);
                }
                else
                {
                    var upperBound = ParseExpr();
                    projectionFilter = new SliceExpr(GetLocation(openBracket), prev, null, upperBound);
                }
            }
            else
            {
                var filter = ParseExpr();
                next = GetToken();

                if (next.Kind == "..")
                {
                    Expr upperBound = null;
                    Match("..");
                    next = GetToken();
                    if (next.Kind != "]")
                    {
                        upperBound = ParseExpr();
                    }
                    Match("]");
                    projectionFilter = new SliceExpr(GetLocation(openBracket), prev, filter, upperBound);
                }
                else
                {
                    Match("]");
                    projectionFilter = new IndexExpr(GetLocation(openBracket), prev, filter);
                }
            }

            return(projectionFilter);
        }
示例#3
0
 public virtual void Visit(SliceExpr expr)
 {
 }