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)); }
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>()); } }
protected abstract bool CanVisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context);
protected override bool CanVisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context) => true;
protected override bool CanVisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context) => context.chainedMemberAccess() == null;
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); }