Example #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;
        }
Example #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);
        }
Example #3
0
 private static ILPattern Optional(ILPattern pattern)
 {
     return new OptionalPattern(pattern);
 }
Example #4
0
 internal SequencePattern(ILPattern[] patterns)
 {
     _patterns = patterns;
 }
Example #5
0
 internal OptionalPattern(ILPattern optional)
 {
     _pattern = optional;
 }
Example #6
0
 private static ILPattern Optional(ILPattern pattern)
 {
     return(new OptionalPattern(pattern));
 }
Example #7
0
 internal OptionalPattern(ILPattern optional)
 {
     _pattern = optional;
 }