Beispiel #1
0
        public bool DeclareVariables(VarDeclarationList List, VarDeclConvMode Mode = VarDeclConvMode.Nothing,
                                     GetIdMode IdMode = GetIdMode.Everywhere)
        {
            var Variables = List.ToVariables(GetPlugin(), BeginEndMode.Both, Mode);

            return(DeclareVariables(Variables, IdMode));
        }
Beispiel #2
0
        public List <IdentifierFound> GetIdentifier(string Name, GetIdMode Mode = GetIdMode.Everywhere,
                                                    Predicate <Identifier> Func = null)
        {
            var Out = new List <IdentifierFound>();

            GetIdentifier(Name, Out, Mode, Func: Func);
            return(Out);
        }
Beispiel #3
0
        public bool DeclareVariables(CodeString Str, List <Modifier> Mods = null,
                                     VarDeclConvMode Mode = VarDeclConvMode.Nothing, GetIdMode IdMode = GetIdMode.Everywhere)
        {
            var List = VarDeclarationList.Create(this, Str, Mods);

            if (List == null)
            {
                return(false);
            }

            return(DeclareVariables(List, Mode, IdMode));
        }
Beispiel #4
0
        public virtual bool DeclareVariables(Variable[] Variables, GetIdMode IdMode = GetIdMode.Everywhere)
        {
            var RetValue = true;

            for (var i = 0; i < Variables.Length; i++)
            {
                if (Variables[i] == null || !DeclareIdentifier(Variables[i]))
                {
                    RetValue = false;
                }
            }

            return(RetValue);
        }
Beispiel #5
0
        public bool GetIdentifier(string Name, List <IdentifierFound> Out, GetIdMode Mode = GetIdMode.Everywhere,
                                  bool SearchedInBasicTypes = false, Predicate <Identifier> Func = null)
        {
            /*if (FunctionScope != null && Mode != GetIdMode.Scope)
             *          {
             *                  Predicate<T> LFunc = x =>
             *                  {
             *                          if (x.Container != this && !IsSubContainerOf(x.Container))
             *                                  return false;
             *
             *                          return Func == null || Func(x);
             *                  };
             *
             *                  FunctionScope.LocalIdentifiers.Get<T>(Name, Out, LFunc);
             *                  if (Mode == GetIdMode.Everywhere && FunctionScope.Parent != null)
             *                          FunctionScope.Parent.GetIdentifier(Name, Out, Mode, SearchedInBasicTypes, Func);
             *          }
             *          else
             *          {*/
            if (!SearchedInBasicTypes)
            {
                var R = GetPredeclaredIdentifier(Name);
                if (R != null && (Func == null || Func(R)))
                {
                    Out.Add(new IdentifierFound(GlobalContainer, R));
                    return(true);
                }

                SearchedInBasicTypes = true;
            }

            var RetValue = GetContainerId(Name, Out, Func);

            if (Parent != null && Mode != GetIdMode.Container)
            {
                var F = FunctionScope;
                if (Mode != GetIdMode.Function || (Parent.FunctionScope == F && F != null))
                {
                    if (Parent.GetIdentifier(Name, Out, Mode, SearchedInBasicTypes, Func))
                    {
                        RetValue = true;
                    }
                }
            }

            return(RetValue);
            //}
        }
Beispiel #6
0
        public override bool DeclareVariables(Variable[] Variables, GetIdMode IdMode = GetIdMode.Everywhere)
        {
            var Ret = base.DeclareVariables(Variables, IdMode);

            for (var i = 0; i < Variables.Length; i++)
            {
                var e = Variables[i];
                if (e != null && e.InitValue != null)
                {
                    Children.Add(new Command(this, e.InitString, CommandType.Expression)
                    {
                        Expressions = new List <ExpressionNode>()
                        {
                            e.InitValue
                        },
                    });
                }
            }

            return(Ret);
        }
Beispiel #7
0
 public bool IsIdDefined(string Name, GetIdMode Mode = GetIdMode.Everywhere, Predicate <Identifier> Func = null)
 {
     return(GetIdentifier(Name, Mode, Func).Count > 0);
 }