Exemplo n.º 1
0
        public override bool VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
        {
            var name = context.memberName()?.GetText();

            if (!string.IsNullOrEmpty(name))
            {
                if (name.Equals("var", StringComparison.OrdinalIgnoreCase))
                {
                    var arguments = context.customFunctionEnclosedArgumentList()?.customFunctionEnclosedArgumentListInner()?.customFunctionEnclosedArgument();
                    if (arguments != null && arguments.Length > 1)
                    {
                        repository.DefineGlobalVariable(arguments[0].GetText().Trim());
                    }
                    else if (arguments == null || arguments.Length == 0)
                    {
                        var chainedName = new FirstChainedMemberAccessNameVisitor().Visit(context);
                        if (!string.IsNullOrEmpty(chainedName))
                        {
                            repository.DefineGlobalVariable(chainedName);
                        }
                    }
                }
            }

            return(base.VisitCustomMemberAccess(context));
        }
        public override string VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
        {
            if (currentLevel == targetLevel || (targetLevel == -1 && context.chainedMemberAccess() == null))
            {
                return(context.memberName().GetText());
            }

            return(base.VisitCustomMemberAccess(context));
        }
Exemplo n.º 3
0
        public override IParseTree[] VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
        {
            if (!CanVisitCustomMemberAccess(context))
            {
                return(base.VisitCustomMemberAccess(context));
            }

            var arguments = context.customFunctionEnclosedArgumentList()?.customFunctionEnclosedArgumentListInner()?.customFunctionEnclosedArgument();

            if (arguments != null && arguments.Length > 0)
            {
                return(arguments);
            }
            else
            {
                return(Array.Empty <IParseTree>());
            }
        }
Exemplo n.º 4
0
 protected abstract bool CanVisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context);
Exemplo n.º 5
0
 protected override bool CanVisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
 => true;
Exemplo n.º 6
0
 protected override bool CanVisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
 => context.chainedMemberAccess() == null;
Exemplo n.º 7
0
 public override string VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
 {
     return(context.memberName().GetText());
 }
        public override bool VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context)
        {
            parentTranspiler.Visit(context.memberName());

            return(true);
        }