Beispiel #1
0
 /// <summary>
 /// Собственно анализ
 /// </summary>
 /// <param name="sender">инициатор события</param>
 /// <param name="e">список токенов</param>
 protected override void DoAnalyse(AnalyserParameters e)
 {
     for (int i = 0; i < e.Length; i++)
     {
         if ((e[i].Token == DelphiTokens.Id) && digits.IsMatch(e[i].Text))
         {
             temp = e[i].Text;
             AddError(e, i);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Собственно анализ
        /// </summary>
        /// <param name="sender">инициатор события</param>
        /// <param name="e">список токенов</param>
        protected override void DoAnalyse(AnalyserParameters e)
        {
            e.First();
            this.e = e;
            ExprResult expr = Expression();

            if (expr.IsConstant && !expr.WasOperand)
            {
                if ((expr.Value.GetType() == typeof(Int32)) && !(settings as AnalyserSettings.CaseConditionSettings).StdNumbers.Contains(Convert.ToInt32(expr.Value)))
                {
                    AddError(e, 0);
                }
                else if ((settings as AnalyserSettings.CaseConditionSettings).LocateStd)
                {
                    AddError((settings as AnalyserSettings.CaseConditionSettings).Message, (settings as AnalyserSettings.CaseConditionSettings).StdLevel, e.File, e[0].Line, e[0].MetaTags);
                }
            }
        }
        /// <summary>
        /// Собственно анализ
        /// </summary>
        /// <param name="sender">инициатор события</param>
        /// <param name="e">список токенов</param>
        protected override void DoAnalyse(AnalyserParameters e)
        {
            e.First();
            if (e.Length > 0)
            {
                switch (e.Current.Token)
                {
                case DelphiTokens.Automated:
                case DelphiTokens.Published:
                case DelphiTokens.Public:
                case DelphiTokens.Protected:
                case DelphiTokens.Private:
                    break;

                default:
                    AddError(e, 0);
                    break;
                }
            }
        }
 /// <summary>
 /// Собственно анализ
 /// </summary>
 /// <param name="sender">инициатор события</param>
 /// <param name="e">список токенов</param>
 protected override void DoAnalyse(AnalyserParameters e)
 {
     e.First();
     if ((e.Length > 1) && (e.MatchTokens(DelphiTokens.Var) || e.MatchTokens(DelphiTokens.Public)))
     {
         e.Next();
         switch (e.Current.Token)
         {
         case DelphiTokens.Id:
         case DelphiTokens.Name:
         case DelphiTokens.Register:
         case DelphiTokens.Message:
         case DelphiTokens.Read:
         case DelphiTokens.Write:
         case DelphiTokens.Default:
             AddError(e, 1);
             break;
         }
     }
 }
        /// <summary>
        /// Собственно анализ
        /// </summary>
        /// <param name="sender">инициатор события</param>
        /// <param name="e">набор токенов</param>
        protected override void DoAnalyse(AnalyserParameters e)
        {
            int i = 0, c = 0;

            while (i < e.Length)
            {
                while (e[i].Token != DelphiTokens.Colon)
                {
                    if (e[i++].Token == DelphiTokens.Id)
                    {
                        c++;
                    }
                }
                i++;
                while ((i < e.Length) && (e[i].Token != DelphiTokens.Semicolon))
                {
                    i++;
                }
            }
            if (c > (settings as AnalyserSettings.FuncParamCountSettings).MaxParamCount)
            {
                AddError(e, 0);
            }
        }
Beispiel #6
0
 /// <summary>
 /// Добавление ошибки
 /// </summary>
 /// <param name="e">набор токенов</param>
 /// <param name="index">номер токена в наборе</param>
 protected void AddError(AnalyserParameters e, int index)
 {
     AddError((settings as AnalyserSettings.BaseStaticSettings).Message, (settings as AnalyserSettings.BaseStaticSettings).Level, e.File, e[index].Line, e[index].MetaTags);
 }
Beispiel #7
0
 /// <summary>
 /// Собственно анализ
 /// </summary>
 /// <param name="sender">инициатор события</param>
 /// <param name="e">набор токенов</param>
 protected abstract void DoAnalyse(AnalyserParameters e);