Exemple #1
0
 /// <summary>
 /// Собственно анализ
 /// </summary>
 /// <param name="sender">инициатор события</param>
 /// <param name="e">список токенов</param>
 protected override void DoAnalyse(AnalyserParameters e)
 {
     e.First();
     this.e = e;
     if (Expression().ConstantExpression)
     {
         AddError(e, 0);
     }
 }
Exemple #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;
         }
     }
 }