Esempio n. 1
0
 // *****************************************************************************
 // IMatchable implementation
 // *****************************************************************************
 public override bool Match(MatchNode matchNode, MatchEngine engine)
 {
     if (!base.Match(matchNode, engine))
     {
         return(false);
     }
     MatchNode.RuleValue rule = matchNode.GetRules().GetOrNull(IMatchable.MatchProperties
                                                               .Exprent_Var_Index);
     if (rule != null)
     {
         if (rule.IsVariable())
         {
             return(engine.CheckAndSetVariableValue((string)rule.value, this.index));
         }
         else
         {
             return(this.index == int.Parse((string)rule.value));
         }
     }
     return(true);
 }
Esempio n. 2
0
        public override bool Match(MatchNode matchNode, MatchEngine engine)
        {
            if (matchNode.GetType() != MatchNode.Matchnode_Statement)
            {
                return(false);
            }
            foreach (KeyValuePair <IMatchable.MatchProperties, MatchNode.RuleValue> rule in matchNode
                     .GetRules())
            {
                switch (rule.Key.ordinal())
                {
                case 0:
                {
                    if (this.type != (int)rule.Value.value)
                    {
                        return(false);
                    }
                    break;
                }

                case 2:
                {
                    if (this.stats.Count != (int)rule.Value.value)
                    {
                        return(false);
                    }
                    break;
                }

                case 3:
                {
                    int exprsize = (int)rule.Value.value;
                    if (exprsize == -1)
                    {
                        if (this.exprents != null)
                        {
                            return(false);
                        }
                    }
                    else if (this.exprents == null || this.exprents.Count != exprsize)
                    {
                        return(false);
                    }
                    break;
                }

                case 1:
                {
                    if (!engine.CheckAndSetVariableValue((string)rule.Value.value, this))
                    {
                        return(false);
                    }
                    break;
                }
                }
            }
            return(true);
        }
Esempio n. 3
0
 // *****************************************************************************
 // IMatchable implementation
 // *****************************************************************************
 public override bool Match(MatchNode matchNode, MatchEngine engine)
 {
     if (!base.Match(matchNode, engine))
     {
         return(false);
     }
     foreach (KeyValuePair <IMatchable.MatchProperties, MatchNode.RuleValue> rule in matchNode
              .GetRules())
     {
         MatchNode.RuleValue        value = rule.Value;
         IMatchable.MatchProperties key   = rule.Key;
         if (key == IMatchable.MatchProperties.Exprent_Consttype)
         {
             if (!value.value.Equals(this.constType))
             {
                 return(false);
             }
         }
         else if (key == IMatchable.MatchProperties.Exprent_Constvalue)
         {
             if (value.IsVariable() && !engine.CheckAndSetVariableValue(value.value.ToString()
                                                                        , this.value))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Esempio n. 4
0
 public override bool Match(MatchNode matchNode, MatchEngine engine)
 {
     if (matchNode.GetType() != MatchNode.Matchnode_Exprent)
     {
         return(false);
     }
     foreach (KeyValuePair <IMatchable.MatchProperties, MatchNode.RuleValue> rule in matchNode
              .GetRules())
     {
         IMatchable.MatchProperties key = rule.Key;
         if (key == IMatchable.MatchProperties.Exprent_Type && this.type != (int)rule.Value
             .value)
         {
             return(false);
         }
         if (key == IMatchable.MatchProperties.Exprent_Ret && !engine.CheckAndSetVariableValue
                 ((string)rule.Value.value, this))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 5
0
 // *****************************************************************************
 // IMatchable implementation
 // *****************************************************************************
 public override bool Match(MatchNode matchNode, MatchEngine engine)
 {
     if (!base.Match(matchNode, engine))
     {
         return(false);
     }
     foreach (KeyValuePair <IMatchable.MatchProperties, MatchNode.RuleValue> rule in matchNode
              .GetRules())
     {
         MatchNode.RuleValue        value = rule.Value;
         IMatchable.MatchProperties key   = rule.Key;
         if (key == IMatchable.MatchProperties.Exprent_Invocation_Parameter)
         {
             if (value.IsVariable() && (value.parameter >= lstParameters.Count || !engine.CheckAndSetVariableValue
                                            (value.value.ToString(), lstParameters[value.parameter])))
             {
                 return(false);
             }
         }
         else if (key == IMatchable.MatchProperties.Exprent_Invocation_Class)
         {
             if (!value.value.Equals(this.classname))
             {
                 return(false);
             }
         }
         else if (key == IMatchable.MatchProperties.Exprent_Invocation_Signature)
         {
             if (!value.value.Equals(this.name + this.stringDescriptor))
             {
                 return(false);
             }
         }
     }
     return(true);
 }