コード例 #1
0
        public override void FinishInitialization(IParserContext context)
        {
            base.FinishInitialization(context);
            string path = Path ?? "";

            _compiledPath = string.IsNullOrEmpty(path) ? null : PathExpression.Compile(context, path);
        }
コード例 #2
0
            public override void VisitPathExpression(PathExpression node)
            {
                // bracketed expressions are not evaluated in scope of the left-hand side
                if (node.Selector is BracketedExpression)
                {
                    base.VisitPathExpression(node);
                    return;
                }
                else
                {
                    node.Expression.Accept(this);

                    // result type of left-side expression is in scope after the dot.
                    var oldPathScope = _binder._pathScope;
                    _binder._pathScope = _binder.GetResultTypeOrError(node.Expression);
                    try
                    {
                        node.Selector.Accept(this);
                    }
                    finally
                    {
                        _binder._pathScope = oldPathScope;
                    }

                    BindNode(node);
                }
            }
コード例 #3
0
        public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
        {
            base.DeepCopy(source, copyManager);
            PropertyAnimationTimeline t = (PropertyAnimationTimeline)source;

            _propertyExpression = t._propertyExpression;
        }
コード例 #4
0
        public override void FinishInitialization(IParserContext context)
        {
            base.FinishInitialization(context);
            string targetProperty = Storyboard.GetTargetProperty(this);

            _propertyExpression = String.IsNullOrEmpty(targetProperty) ? null : PathExpression.Compile(context, targetProperty);
        }
コード例 #5
0
 public override RxKqlScalarValue VisitPathExpression(PathExpression node)
 {
     return(new RxKqlScalarValue
     {
         Left = node.ToString().Trim().Replace(" . ", "_"),
         Right = node.Accept(new ScalarValueConverter())
     });
 }
コード例 #6
0
 void IEvaluableMarkupExtension.Initialize(IParserContext context)
 {
     if (_path == null)
     {
         throw new XamlBindingException("CommandBaseMarkupExtension: Path mustn't be null");
     }
     _compiledPath = PathExpression.Compile(context, _path);
 }
コード例 #7
0
 public override ScalarValue VisitPathExpression(PathExpression node)
 {
     return(new ScalarPath
     {
         Element = node.Expression.Accept(this),
         Selector = node.Selector.Accept(this)
     });
 }
コード例 #8
0
 void IInitializable.FinishInitialization(IParserContext context)
 {
     if (_path == null)
     {
         throw new XamlBindingException("{0}: Path mustn't be null", GetType().Name);
     }
     _compiledPath = PathExpression.Compile(context, _path);
     ResourceDictionary.RegisterUnmodifiableResourceDuringParsingProcess(this, context);
 }
コード例 #9
0
            public override void VisitPathExpression(PathExpression node)
            {
                base.VisitPathExpression(node);

                // expressions on right-hand side of a dot have path scope
                if (_position >= node.Selector.TriviaStart)
                {
                    _binder._pathScope = node.Expression.ResultType;
                }
            }
コード例 #10
0
        protected override System.Linq.Expressions.Expression VisitPathExpression(PathExpression pex)
        {
            return(System.Linq.Expressions.Expression.Call(
                       System.Linq.Expressions.Expression.Constant(this),
#if netstandard
                       new Func <BindingContext, string, object>(ResolvePath).GetMethodInfo(),
#else
                       new Func <BindingContext, string, object>(ResolvePath).Method,
#endif
                       CompilationContext.BindingContext,
                       System.Linq.Expressions.Expression.Constant(pex.Path)));
        }
コード例 #11
0
        public void PathExpressionConstructorWorks()
        {
            // Arrange
            string name = "anyValue";

            // Act
            var path = new PathExpression(name);

            // Assert
            Assert.Equal("path.anyValue", path.Expression);
            Assert.Equal("anyValue", path.Name);
        }
コード例 #12
0
 public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
 {
   base.DeepCopy(source, copyManager);
   CommandBaseMarkupExtension cbme = (CommandBaseMarkupExtension) source;
   _source.Source = copyManager.GetCopy(cbme._source.Source);
   _source.ElementName = cbme._source.ElementName;
   _source.RelativeSource = cbme._source.RelativeSource;
   _path = cbme._path;
   _compiledPath = cbme._compiledPath;
   _source.Converter = copyManager.GetCopy(cbme._source.Converter);
   _source.ConverterParameter = copyManager.GetCopy(cbme._source.ConverterParameter);
 }
コード例 #13
0
        public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
        {
            base.DeepCopy(source, copyManager);
            CommandBaseMarkupExtension cbme = (CommandBaseMarkupExtension)source;

            _source.Source         = copyManager.GetCopy(cbme._source.Source);
            _source.ElementName    = cbme._source.ElementName;
            _source.RelativeSource = cbme._source.RelativeSource;
            _path                      = cbme._path;
            _compiledPath              = cbme._compiledPath;
            _source.Converter          = copyManager.GetCopy(cbme._source.Converter);
            _source.ConverterParameter = copyManager.GetCopy(cbme._source.ConverterParameter);
        }
コード例 #14
0
ファイル: Engine.cs プロジェクト: grass-team/grass-lang
        private Object evalNewExpression(Object context, NewExpression expression)
        {
            CallExpression ctorCallExp;
            Prototype      prototype;

            if (expression.ctorCall is CallExpression ctorCall)
            {
                string typeName     = ctorCall.Function.Literal;
                Object prototypeObj = ExecutionContext.Peek()[typeName];
                if (prototypeObj is not Prototype)
                {
                    throw new System.Exception("The object named \"" +
                                               typeName + "\" is not a type");
                }
                ctorCallExp = ctorCall;
                prototype   = prototypeObj as Prototype;
            }
            else
            {
                // is PathExpression
                PathExpression    typePath = expression.ctorCall as PathExpression;
                List <Expression> path     = typePath.Path;
                Expression        pathCall = path[path.Count - 1];
                if (pathCall is not CallExpression)
                {
                    throw new System.Exception("Need a type");
                }
                // get the parent of prototype
                PathExpression parentPath = typePath.SubPath(0, -1);
                Object         parent     = Eval(ExecutionContext.Peek(), parentPath);
                ctorCallExp = pathCall as CallExpression;
                if (parent[ctorCallExp.Function.Literal] is Prototype prototypeTarget)
                {
                    prototype = prototypeTarget;
                }
                else
                {
                    throw new System.Exception("Need a type");
                }
            }
            Prototype     type       = prototype;
            List <Object> callParams = new List <Object>();

            foreach (Expression param in ctorCallExp.Parameters)
            {
                callParams.Add(Eval(ExecutionContext.Peek(), param));
            }
            return(type.Create(callParams));
        }
コード例 #15
0
ファイル: ScriptEval.cs プロジェクト: rokuan/iris
        public ObjectExpression evalPathExpression(PathExpression exp)
        {
            if (exp is VariableExpression)
            {
                return(variables[((VariableExpression)exp).name]);
            }

            /*else if (exp is MemberAccessExpression)
             * {
             *  memberExp = (MemberAccessExpression)exp;
             * }*/

            //erreur
            return(null);
        }
コード例 #16
0
        public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
        {
            Detach();
            base.DeepCopy(source, copyManager);
            BindingMarkupExtension bme = (BindingMarkupExtension)source;

            Source         = copyManager.GetCopy(bme.Source);
            ElementName    = bme.ElementName;
            RelativeSource = bme.RelativeSource;
            CheckTypeOfSource();
            Path = bme.Path;
            Mode = bme.Mode;
            UpdateSourceTrigger = bme.UpdateSourceTrigger;
            Converter           = copyManager.GetCopy(bme.Converter);
            ConverterParameter  = copyManager.GetCopy(bme.ConverterParameter);

            _compiledPath = bme._compiledPath;
            Attach();
        }
コード例 #17
0
            public override void VisitPathExpression(PathExpression node)
            {
                node.Expression.Accept(this);

                // result type of left-side expression is in scope after the dot.
                var oldPathScope = _binder._pathScope;

                _binder._pathScope = _binder.GetResultTypeOrError(node.Expression);
                try
                {
                    node.Selector.Accept(this);
                }
                finally
                {
                    _binder._pathScope = oldPathScope;
                }

                BindNode(node);
            }
コード例 #18
0
        public TestedParameter( SemanticModel model, ExpressionSyntax expression )
        {
            Expression = expression;
            if( expression == null )
            {
                Name = Case.NoParameter;
                Path = Name;
                return;
            }

            if( model.GetConstantValue( Expression ).Value is string result )
            {
                Name = result;
                Path = Name;
                return;
            }

            // Lambda?
            if( !( Expression is ParenthesizedLambdaExpressionSyntax lambda ) )
            {
                Name = Case.NoParameter;
                Path = Name;
                return;
            }

            IsLambda = true;
            var parameter = lambda.ParameterList.Parameters[ 0 ];
            Type = (ITypeSymbol)model.GetSymbol( parameter.Type );
            Name = parameter.Identifier.Text;
            Path = Name;
            PathExpression = lambda.Body as ExpressionSyntax;
            if( PathExpression == null )
                PathHasErrors = true;
            else
            {
                var pathVisitor = new PathVisitor( Name );
                pathVisitor.Visit( PathExpression );
                PathHasErrors = pathVisitor.HasErrors;
                Path = PathHasErrors
                           ? PathExpression.ToString()
                           : pathVisitor.PathStr;
            }
        }
コード例 #19
0
        void IEvaluableMarkupExtension.Initialize(IParserContext context)
        {
            string localName;
            string namespaceURI;

            context.LookupNamespace(_typeName, out localName, out namespaceURI);
            Type            type = context.GetNamespaceHandler(namespaceURI).GetElementType(localName);
            IDataDescriptor result;

            try
            {
                if (PathExpression.Compile(context, _staticMemberName).Evaluate(
                        new ValueDataDescriptor(type), out result))
                {
                    _value = result.Value;
                }
            }
            catch (XamlBindingException e)
            {
                ServiceRegistration.Get <ILogger>().Warn("Error evaluating Static markup", e);
            }
        }
コード例 #20
0
 public override void FinishInitialization(IParserContext context)
 {
   base.FinishInitialization(context);
   string path = Path ?? "";
   _compiledPath = string.IsNullOrEmpty(path) ? null : PathExpression.Compile(context, path);
 }
コード例 #21
0
 public void VisitPathExpression(PathExpression pathExpr)
 {
     throw new NotImplementedException();
 }
コード例 #22
0
        internal static LogicalExpression <TSource> CompileLogicalExpression <TSource, TToken>(string text, Func <string, TToken> pathToken)
            where TToken : Token <TSource>
        {
            LogicalExpression <TSource> result = null;

            var whereMatch = parser.Match(text);

            if (whereMatch == null || !whereMatch.Success)
            {
                throw new ArgumentException("Invalid expression \"" + text + "\".");
            }

            var exprCaptures = whereMatch.Groups["expr"].Captures;
            var nextCaptures = whereMatch.Groups["next"].Captures;

            AndExpressionGroup <TSource> andGroup = null;

            for (var i = 0; i < exprCaptures.Count; i++)
            {
                var exprText = exprCaptures[i].Value.Trim();
                var nextText = nextCaptures[i].Value.Trim();

                IEvaluate <TSource> expr;

                if (Regex.IsMatch(exprText, @"^\(.*\)$"))
                {
                    expr = CompileLogicalExpression <TSource, TToken>(exprText.Substring(1, exprText.Length - 2), pathToken);
                }
                else
                {
                    var exprMatch = exprParser.Match(exprText);

                    if (exprMatch == null || !exprMatch.Success)
                    {
                        throw new Exception("Invalid expression \"" + exprText + "\".");
                    }

                    var leftText  = exprMatch.Groups["left"].Value.Trim();
                    var opText    = exprMatch.Groups["op"].Value.Trim();
                    var rightText = exprMatch.Groups["right"].Value.Trim();

                    if (string.IsNullOrEmpty(opText))
                    {
                        // No operator, so this is a truthy property or constant check.

                        object value;
                        if (JavaScriptHelpers.TryParseConstant(leftText, out value))
                        {
                            expr = new TruthyConstantExpression <TSource>(new ConstantToken <TSource>(value));
                        }
                        else
                        {
                            expr = new PathExpression <TSource>(pathToken(leftText));
                        }
                    }
                    else
                    {
                        // Parse the comparison operator.
                        LogicalOperator op = ParseLogicalOperator(opText);

                        // Parse the left-hand token.
                        Token <TSource> leftToken;
                        object          leftValue;
                        if (JavaScriptHelpers.TryParseConstant(leftText, out leftValue))
                        {
                            leftToken = new ConstantToken <TSource>(leftValue);
                        }
                        else
                        {
                            leftToken = pathToken(leftText);
                        }

                        // Parse the right-hand token.
                        Token <TSource> rightToken;
                        object          rightValue;
                        if (JavaScriptHelpers.TryParseConstant(rightText, out rightValue))
                        {
                            rightToken = new ConstantToken <TSource>(rightValue);
                        }
                        else
                        {
                            rightToken = pathToken(rightText);
                        }

                        // Create the expression from "left op right".
                        expr = new CompareExpression <TSource>(leftToken, op, rightToken);
                    }
                }

                if (nextText == "&&" && andGroup == null)
                {
                    // There is currently no active and group and the next expression
                    // will be "ANDed", so start a new and group, beginning with this expression.
                    andGroup = AndExpressionGroup <TSource> .Begin(expr);
                }
                else if (andGroup != null)
                {
                    // There is an active and group expression, so add this expression to it.
                    andGroup.And(expr);
                }
                else if (result != null)
                {
                    // There is currently a result, so or it with this expression.
                    result = result.Or(expr);
                }
                else
                {
                    // There is currently no result, so use this expression as the result.
                    result = new TruthyExpressionWrapper <TSource>(expr);
                }

                // Add the existing group if we have reached the end of the expression, or the next expression will be "ORed".
                if ((string.IsNullOrEmpty(nextText) || nextText == "||") && andGroup != null)
                {
                    if (result == null)
                    {
                        result = andGroup;
                    }
                    else
                    {
                        result = result.Or(andGroup);
                    }
                    andGroup = null;
                }
            }

            return(result);
        }
コード例 #23
0
ファイル: Parser.cs プロジェクト: hazama-yuinyan/Expresso
        AstType ConvertPathToType(PathExpression path)
        {
            AstType type = null;
            foreach(var item in path.Items){
            item.Remove();
            if(type == null)
                type = AstType.MakeSimpleType(item, TextLocation.Empty);
            else
                type = AstType.MakeMemberType(type, AstType.MakeSimpleType(item, TextLocation.Empty), TextLocation.Empty);
            }

            return type;
        }
コード例 #24
0
ファイル: VariableUpdate.cs プロジェクト: rokuan/iris
 public VariableUpdate(PathExpression varPath, Token.TokenValue opUpdate)
 {
     this.variable = varPath;
     this.op = opUpdate;
 }
コード例 #25
0
ファイル: ScriptEval.cs プロジェクト: rokuan/iris
        public ObjectExpression evalPathExpression(PathExpression exp)
        {
            if (exp is VariableExpression)
            {
                return variables[((VariableExpression)exp).name];
            }
            /*else if (exp is MemberAccessExpression)
            {
                memberExp = (MemberAccessExpression)exp;
            }*/

            //erreur
            return null;
        }
コード例 #26
0
        IContentExpression ParseExpression(Queue <DslToken> q, Func <DslToken, bool> terminate)
        {
            IContentExpression exp = null;

            while (q.Count > 0)
            {
                var lookAhead = q.Peek();

                if (terminate(lookAhead))
                {
                    break;
                }

                else if (lookAhead.IsConstant())
                {
                    if (exp != null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token = q.DequeueAndValidate(Utils.ConstantTokens);
                    exp = CreateConstant(token);
                }

                else if (lookAhead.TokenType == TokenType.Equals)
                {
                    if (exp == null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token = q.DequeueAndValidate(TokenType.Equals);
                    exp = new EqualToFilter(exp,
                                            ParseExpression(q, t => t.TokenType == TokenType.And || t.TokenType == TokenType.Or || terminate(t)));
                }

                else if (lookAhead.TokenType == TokenType.Contains)
                {
                    if (exp == null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token = q.DequeueAndValidate(TokenType.Contains);
                    exp = new ContainsFilter(exp,
                                             ParseExpression(q, t => t.TokenType == TokenType.And || t.TokenType == TokenType.Or || terminate(t)));
                }

                else if (lookAhead.TokenType == TokenType.MatchRegex)
                {
                    if (exp == null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token   = q.DequeueAndValidate(TokenType.MatchRegex);
                    var pattern = q.DequeueAndValidate(TokenType.String);
                    exp = new RegexFilter(exp, pattern.Value);
                }

                else if (lookAhead.TokenType == TokenType.And)
                {
                    if (exp == null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token = q.DequeueAndValidate(TokenType.And);
                    if (exp is IContentFilter leftBool)
                    {
                        var right = ParseExpression(q, terminate);
                        if (right is IContentFilter rightBool)
                        {
                            exp = new AndFilter(leftBool, rightBool);
                        }
                        else
                        {
                            throw new ParserException("AND cannot have a right operand that does not yield boolean", token);
                        }
                    }
                    else
                    {
                        throw new ParserException("AND cannot have a left operand that does not yield boolean", token);
                    }
                }

                else if (lookAhead.TokenType == TokenType.Or)
                {
                    if (exp == null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token = q.DequeueAndValidate(TokenType.Or);
                    if (exp is IContentFilter leftBool)
                    {
                        var right = ParseExpression(q, terminate);
                        if (right is IContentFilter rightBool)
                        {
                            exp = new OrFilter(leftBool, rightBool);
                        }
                        else
                        {
                            throw new ParserException("OR cannot have a right operand that does not yield boolean", token);
                        }
                    }
                    else
                    {
                        throw new ParserException("OR cannot have a left operand that does not yield boolean", token);
                    }
                }

                else if (lookAhead.TokenType == TokenType.Path)
                {
                    if (exp == null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    var token = q.DequeueAndValidate(TokenType.Path);
                    exp = new PathExpression(exp, ContentPath.Parse($"$.{token.Value.TrimStart('.')}"));
                }

                else if (lookAhead.TokenType == TokenType.DollarSign)
                {
                    if (exp != null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    q.DequeueAndValidate(TokenType.DollarSign);
                    exp = new ScopeRootExpression();
                }

                else if (lookAhead.TokenType == TokenType.OpenCurly)
                {
                    if (exp != null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    exp = CreateObjectExpression(q);
                }

                else if (lookAhead.TokenType == TokenType.OpenSquareBracket)
                {
                    if (exp != null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    exp = CreateListExpression(q);
                }

                else if (lookAhead.TokenType == TokenType.OpenBracket)
                {
                    if (exp != null)
                    {
                        throw new ParserException($"Unexpected token", lookAhead);
                    }
                    q.DequeueAndValidate(TokenType.OpenBracket);  // open bracket (
                    exp = ParseExpression(q, t => t.TokenType == TokenType.CloseBracket);
                    q.DequeueAndValidate(TokenType.CloseBracket); // close bracket )
                }
                else
                {
                    throw new ParserException($"Unexpected token", lookAhead);
                }
            }

            if (exp == null)
            {
                throw new ParserException($"Unexpected end", null);
            }

            return(exp);
        }
コード例 #27
0
ファイル: KqlSyntaxVisitor.cs プロジェクト: tatecksi/KqlTools
 public override T VisitPathExpression(PathExpression node)
 {
     throw new NotImplementedException();
 }
コード例 #28
0
ファイル: Parser.cs プロジェクト: hazama-yuinyan/Expresso
 void PathExpression(out PathExpression path)
 {
     var paths = new List<Identifier>();
     Expect(14);
     paths.Add(AstNode.MakeIdentifier(t.val, CurrentLocation));
     while (la.kind == 5) {
     Get();
     Expect(14);
     paths.Add(AstNode.MakeIdentifier(t.val, CurrentLocation));
     }
     var last_ident = paths.Last();
     last_ident.Type = new PlaceholderType(TextLocation.Empty);
     path = Expression.MakePath(paths);
 }
コード例 #29
0
 /// <summary>
 /// Creates a new <see cref="PropertyAnimationTimeline"/> for use in Code.
 /// </summary>
 public PropertyAnimationTimeline(PathExpression animatePropertyExpression) : this()
 {
     _propertyExpression = animatePropertyExpression;
 }
コード例 #30
0
 public override List <RxKqlScalarValue> VisitPathExpression(PathExpression node)
 {
     throw new NotImplementedException();
 }
コード例 #31
0
    public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
    {
      Detach();
      base.DeepCopy(source, copyManager);
      BindingMarkupExtension bme = (BindingMarkupExtension) source;
      Source = copyManager.GetCopy(bme.Source);
      ElementName = bme.ElementName;
      RelativeSource = bme.RelativeSource;
      CheckTypeOfSource();
      Path = bme.Path;
      Mode = bme.Mode;
      UpdateSourceTrigger = bme.UpdateSourceTrigger;
      Converter = copyManager.GetCopy(bme.Converter);
      ConverterParameter = copyManager.GetCopy(bme.ConverterParameter);

      _compiledPath = bme._compiledPath;
      Attach();
    }
 public DeferredBlockAccumulatorContext(Expression startingNode)
     : base(startingNode)
 {
     startingNode  = UnwrapStatement(startingNode);
     _startingNode = (PathExpression)startingNode;
 }
コード例 #33
0
 public override void FinishInitialization(IParserContext context)
 {
   base.FinishInitialization(context);
   string targetProperty = Storyboard.GetTargetProperty(this);
   _propertyExpression = String.IsNullOrEmpty(targetProperty) ? null : PathExpression.Compile(context, targetProperty);
 }
コード例 #34
0
 protected virtual System.Linq.Expressions.Expression VisitPathExpression(PathExpression pex)
 {
     return(pex);
 }
コード例 #35
0
 /// <summary>
 /// Creates a new <see cref="PropertyAnimationTimeline"/> for use in Code.
 /// </summary>
 public PropertyAnimationTimeline(PathExpression animatePropertyExpression): this()
 {
   _propertyExpression = animatePropertyExpression;
 }
コード例 #36
0
 public VariableUpdate(PathExpression varPath, Token.TokenValue opUpdate)
 {
     this.variable = varPath;
     this.op       = opUpdate;
 }
コード例 #37
0
 public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
 {
   base.DeepCopy(source, copyManager);
   PropertyAnimationTimeline t = (PropertyAnimationTimeline) source;
   _propertyExpression = t._propertyExpression;
 }
コード例 #38
0
 protected virtual Expression VisitPathExpression(PathExpression pex)
 {
     return(pex);
 }
コード例 #39
0
ファイル: Writer.cs プロジェクト: archfrog/Braceless0
        public override object Visit(PathExpression that, object value)
        {
            Storage index = new TemporaryStorage(CreateTemporary());

            switch (that.PathKind)
            {
                case PathKind.Absolute:
                    break;

                case PathKind.Instance:
                    //_writer.Write("_");
                    break;

                case PathKind.Relative:
                    break;
            }

            _writer.Write(index.ToString() + " = ");
            that.Expression.Visit(this);
            _writer.WriteLine();

            return (object) index;
        }
コード例 #40
0
 public DeferredBlockAccumulatorContext(Expression startingNode)
 {
     _startingNode = (PathExpression)UnwrapStatement(startingNode);
 }
コード例 #41
0
 void IEvaluableMarkupExtension.Initialize(IParserContext context)
 {
   if (_path == null)
     throw new XamlBindingException("CommandBaseMarkupExtension: Path mustn't be null");
   _compiledPath = PathExpression.Compile(context, _path);
 }
コード例 #42
0
        public void VisitPathExpression(PathExpression pathExpr)
        {
            // Side effect: After exiting this method, the symbol_table field will be set to
            // the type table corresponding to the most descendant type the path represents.
            if(pathExpr.Items.Count == 1){
                pathExpr.AsIdentifier.AcceptWalker(this);
            }else{
                while(symbol_table.Parent != null)
                    symbol_table = symbol_table.Parent;

                foreach(var ident in pathExpr.Items){
                    ident.AcceptWalker(this);
                    symbol_table = symbol_table.GetTypeTable(ident.Name);
                }
            }
        }
コード例 #43
0
 private static bool IsSectionOrClosingNode(PathExpression pathExpression)
 {
     return((pathExpression != null) && pathExpression.Path.IndexOfAny(new[] { '#', '/', '^' }) == 0);
 }