예제 #1
0
        internal static MatchContext Match(MethodBase method, ILPattern pattern)
        {
            if (method == null)
                throw new ArgumentNullException("method");

            if (pattern == null)
                throw new ArgumentNullException("pattern");

            var instructions = (IList<Instruction>) MethodBodyReader.GetInstructions(method).AsReadOnly();
            if (instructions.Count == 0)
                throw new ArgumentException();

            var context = new MatchContext(instructions[0]);
            pattern.Match(context);
            return context;
        }
예제 #2
0
        internal static MatchContext Match(MethodBase method, ILPattern pattern)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            if (pattern == null)
            {
                throw new ArgumentNullException("pattern");
            }

            var instructions = (IList <Instruction>)MethodBodyReader.GetInstructions(method).AsReadOnly();

            if (instructions.Count == 0)
            {
                throw new ArgumentException();
            }

            var context = new MatchContext(instructions[0]);

            pattern.Match(context);
            return(context);
        }
예제 #3
0
 private static ILPattern Optional(ILPattern pattern)
 {
     return new OptionalPattern(pattern);
 }
예제 #4
0
 internal SequencePattern(ILPattern[] patterns)
 {
     _patterns = patterns;
 }
예제 #5
0
 internal OptionalPattern(ILPattern optional)
 {
     _pattern = optional;
 }
예제 #6
0
 private static ILPattern Optional(ILPattern pattern)
 {
     return(new OptionalPattern(pattern));
 }
예제 #7
0
 internal OptionalPattern(ILPattern optional)
 {
     _pattern = optional;
 }