Example #1
0
 internal static bool IsCompatibleScope(StackMatchExpression expr, ScopeStack scope, ref string matchingKey, ref int depth)
 {
     depth = 0;
     if (scope.Count == 1)
     {
         var result = expr.MatchesStack(scope, ref matchingKey);
         if (result.Item1)
         {
             return(true);
         }
         depth = 1;
     }
     else
     {
         depth = 0;
         while (!scope.IsEmpty)
         {
             var result = expr.MatchesStack(scope, ref matchingKey);
             if (result.Item1)
             {
                 return(true);
             }
             scope = scope.Pop();
             depth++;
         }
     }
     return(false);
 }
Example #2
0
            public override (bool, ScopeStack) MatchesStack(ScopeStack scopeStack, ref string matchExpr)
            {
                var secondResult = right.MatchesStack(scopeStack, ref matchExpr);

                if (secondResult.Item1)
                {
                    return(left.MatchesStack(secondResult.Item2, ref matchExpr));
                }
                return(secondResult);
            }