RegexOpCodes.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. // M(TagName)
  6. // ClassName == TagName##Inst
  7. // MTemplate(TagName, TemplateDeclaration, GenericClassName, SpecializedClassName)
  8. // 0x00
  9. M(Nop) // Opcode byte 0x00 is a NOP (allows for NOP-sleds for alignment if necessary)
  10. M(Fail)
  11. M(Succ)
  12. M(Jump)
  13. M(JumpIfNotChar)
  14. M(MatchCharOrJump)
  15. M(JumpIfNotSet)
  16. M(MatchSetOrJump)
  17. // 0x08
  18. M(Switch2)
  19. M(Switch4)
  20. M(Switch8)
  21. M(Switch16) // 16 = 0x10
  22. M(Switch24) // 24 = 0x18 (support at least 20 slots from previous iteration, less fragmentation (<= 7 empty)
  23. M(SwitchAndConsume2)
  24. M(SwitchAndConsume4)
  25. M(SwitchAndConsume8)
  26. M(SwitchAndConsume16)
  27. M(SwitchAndConsume24)
  28. MTemplate(BOIHardFailTest, template<bool canHardFail>, BOITestInst, BOITestInst<true>)
  29. MTemplate(BOITest, template<bool canHardFail>, BOITestInst, BOITestInst<false>)
  30. MTemplate(EOIHardFailTest, template<bool canHardFail>, EOITestInst, EOITestInst<true>)
  31. MTemplate(EOITest, template<bool canHardFail>, EOITestInst, EOITestInst<false>)
  32. M(BOLTest)
  33. M(EOLTest)
  34. // TODO (doilij) update Tag numbers
  35. // 0x10
  36. MTemplate(NegatedWordBoundaryTest, template<bool isNegation>, WordBoundaryTestInst, WordBoundaryTestInst<true>)
  37. MTemplate(WordBoundaryTest, template<bool isNegation>, WordBoundaryTestInst, WordBoundaryTestInst<false>)
  38. M(MatchChar)
  39. M(MatchChar2)
  40. M(MatchChar3)
  41. M(MatchChar4)
  42. MTemplate(MatchSet, template<bool IsNegation>, MatchSetInst, MatchSetInst<false>)
  43. MTemplate(MatchNegatedSet, template<bool IsNegation>, MatchSetInst, MatchSetInst<true>)
  44. M(MatchLiteral)
  45. // 0x18
  46. M(MatchLiteralEquiv)
  47. M(MatchTrie)
  48. M(OptMatchChar)
  49. M(OptMatchSet)
  50. M(SyncToCharAndContinue)
  51. M(SyncToChar2SetAndContinue)
  52. MTemplate(SyncToSetAndContinue, template<bool IsNegation>, SyncToSetAndContinueInst, SyncToSetAndContinueInst<false>)
  53. MTemplate(SyncToNegatedSetAndContinue, template<bool IsNegation>, SyncToSetAndContinueInst, SyncToSetAndContinueInst<true>)
  54. // 0x20
  55. M(SyncToChar2LiteralAndContinue) // SyncToLiteralAndContinueInstT<Char2LiteralScannerMixin>
  56. M(SyncToLiteralAndContinue) // SyncToLiteralAndContinueInstT<ScannerMixin>
  57. M(SyncToLinearLiteralAndContinue) // SyncToLiteralAndContinueInstT<ScannerMixin_WithLinearCharMap>
  58. M(SyncToLiteralEquivAndContinue) // SyncToLiteralAndContinueInstT<EquivScannerMixin>
  59. M(SyncToLiteralEquivTrivialLastPatCharAndContinue) // SyncToLiteralAndContinueInstT<EquivTrivialLastPatCharScannerMixin>
  60. M(SyncToCharAndConsume)
  61. M(SyncToChar2SetAndConsume)
  62. MTemplate(SyncToSetAndConsume, template<bool IsNegation>, SyncToSetAndConsumeInst, SyncToSetAndConsumeInst<false>)
  63. // 0x28
  64. MTemplate(SyncToNegatedSetAndConsume, template<bool IsNegation>, SyncToSetAndConsumeInst, SyncToSetAndConsumeInst<true>)
  65. M(SyncToChar2LiteralAndConsume) // SyncToLiteralAndConsumeInstT<Char2LiteralScannerMixin>
  66. M(SyncToLiteralAndConsume) // SyncToLiteralAndConsumeInstT<ScannerMixin>
  67. M(SyncToLinearLiteralAndConsume) // SyncToLiteralAndConsumeInstT<ScannerMixin_WithLinearCharMap>
  68. M(SyncToLiteralEquivAndConsume) // SyncToLiteralAndConsumeInstT<EquivScannerMixin>
  69. M(SyncToLiteralEquivTrivialLastPatCharAndConsume) // SyncToLiteralAndConsumeInstT<EquivTrivialLastPatCharScannerMixin>
  70. M(SyncToCharAndBackup)
  71. // REVIEW (doilij): why not have a SyncToChar2SetAndBackup ?
  72. MTemplate(SyncToSetAndBackup, template<bool IsNegation>, SyncToSetAndBackupInst, SyncToSetAndBackupInst<false>)
  73. // 0x30
  74. MTemplate(SyncToNegatedSetAndBackup, template<bool IsNegation>, SyncToSetAndBackupInst, SyncToSetAndBackupInst<true>)
  75. M(SyncToChar2LiteralAndBackup) // SyncToLiteralAndBackupInstT<Char2LiteralScannerMixin>
  76. M(SyncToLiteralAndBackup) // SyncToLiteralAndBackupInstT<ScannerMixin>
  77. M(SyncToLinearLiteralAndBackup) // SyncToLiteralAndBackupInstT<ScannerMixin_WithLinearCharMap>
  78. M(SyncToLiteralEquivAndBackup) // SyncToLiteralAndBackupInstT<EquivScannerMixin>
  79. M(SyncToLiteralEquivTrivialLastPatCharAndBackup) // SyncToLiteralAndBackupInstT<EquivTrivialLastPatCharScannerMixin>
  80. M(SyncToLiteralsAndBackup)
  81. M(MatchGroup)
  82. // 0x38
  83. M(BeginDefineGroup)
  84. M(EndDefineGroup)
  85. M(DefineGroupFixed)
  86. M(BeginLoop)
  87. M(RepeatLoop)
  88. M(BeginLoopIfChar)
  89. M(BeginLoopIfSet)
  90. M(RepeatLoopIfChar)
  91. // 0x40
  92. M(RepeatLoopIfSet)
  93. M(BeginLoopFixed)
  94. M(RepeatLoopFixed)
  95. M(LoopSet)
  96. M(LoopSetWithFollowFirst)
  97. M(BeginLoopFixedGroupLastIteration)
  98. M(RepeatLoopFixedGroupLastIteration)
  99. M(BeginGreedyLoopNoBacktrack)
  100. // 0x48
  101. M(RepeatGreedyLoopNoBacktrack)
  102. MTemplate(ChompCharStar, template<ChompMode Mode>, ChompCharInst, ChompCharInst<ChompMode::Star>)
  103. MTemplate(ChompCharPlus, template<ChompMode Mode>, ChompCharInst, ChompCharInst<ChompMode::Plus>)
  104. MTemplate(ChompSetStar, template<ChompMode Mode>, ChompSetInst, ChompSetInst<ChompMode::Star>)
  105. MTemplate(ChompSetPlus, template<ChompMode Mode>, ChompSetInst, ChompSetInst<ChompMode::Plus>)
  106. MTemplate(ChompCharGroupStar, template<ChompMode Mode>, ChompCharGroupInst, ChompCharGroupInst<ChompMode::Star>)
  107. MTemplate(ChompCharGroupPlus, template<ChompMode Mode>, ChompCharGroupInst, ChompCharGroupInst<ChompMode::Plus>)
  108. MTemplate(ChompSetGroupStar, template<ChompMode Mode>, ChompSetGroupInst, ChompSetGroupInst<ChompMode::Star>)
  109. // 0x50
  110. MTemplate(ChompSetGroupPlus, template<ChompMode Mode>, ChompSetGroupInst, ChompSetGroupInst<ChompMode::Plus>)
  111. M(ChompCharBounded)
  112. M(ChompSetBounded)
  113. M(ChompSetBoundedGroupLastChar)
  114. M(Try)
  115. M(TryIfChar)
  116. M(TryMatchChar)
  117. M(TryIfSet)
  118. // 0x58
  119. M(TryMatchSet)
  120. M(BeginAssertion)
  121. M(EndAssertion)