The Labs \ Source Viewer \ SSCLI \ System.Text.RegularExpressions \ CompiledRegexRunner

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CompiledRegexRunner.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System;
  16. using System.Diagnostics;
  17. using System.Reflection.Emit;
  18. namespace System.Text.RegularExpressions
  19. {
  20.    
  21.     internal sealed class CompiledRegexRunner : RegexRunner
  22.     {
  23.         NoParamDelegate goMethod;
  24.         FindFirstCharDelegate findFirstCharMethod;
  25.         NoParamDelegate initTrackCountMethod;
  26.        
  27.         internal CompiledRegexRunner()
  28.         {
  29.         }
  30.        
  31.         internal void SetDelegates(NoParamDelegate go, FindFirstCharDelegate firstChar, NoParamDelegate trackCount)
  32.         {
  33.             goMethod = go;
  34.             findFirstCharMethod = firstChar;
  35.             initTrackCountMethod = trackCount;
  36.         }
  37.        
  38.         protected override void Go()
  39.         {
  40.             goMethod(this);
  41.         }
  42.        
  43.         protected override bool FindFirstChar()
  44.         {
  45.             return findFirstCharMethod(this);
  46.         }
  47.        
  48.         protected override void InitTrackCount()
  49.         {
  50.             initTrackCountMethod(this);
  51.         }
  52.     }
  53.    
  54.     internal delegate void NoParamDelegate(RegexRunner r);
  55.     internal delegate bool FindFirstCharDelegate(RegexRunner r);
  56.    
  57. }

Developer Fusion