libregexp-opcode.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Regular Expression Engine
  3. *
  4. * Copyright (c) 2017-2018 Fabrice Bellard
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. */
  24. #ifdef DEF
  25. DEF(invalid, 1) /* never used */
  26. DEF(char, 3)
  27. DEF(char_i, 3)
  28. DEF(char32, 5)
  29. DEF(char32_i, 5)
  30. DEF(dot, 1)
  31. DEF(any, 1) /* same as dot but match any character including line terminator */
  32. DEF(space, 1)
  33. DEF(not_space, 1) /* must come after */
  34. DEF(line_start, 1)
  35. DEF(line_start_m, 1)
  36. DEF(line_end, 1)
  37. DEF(line_end_m, 1)
  38. DEF(goto, 5)
  39. DEF(split_goto_first, 5)
  40. DEF(split_next_first, 5)
  41. DEF(match, 1)
  42. DEF(lookahead_match, 1)
  43. DEF(negative_lookahead_match, 1) /* must come after */
  44. DEF(save_start, 2) /* save start position */
  45. DEF(save_end, 2) /* save end position, must come after saved_start */
  46. DEF(save_reset, 3) /* reset save positions */
  47. DEF(loop, 6) /* decrement the top the stack and goto if != 0 */
  48. DEF(loop_split_goto_first, 10) /* loop and then split */
  49. DEF(loop_split_next_first, 10)
  50. DEF(loop_check_adv_split_goto_first, 10) /* loop and then check advance and split */
  51. DEF(loop_check_adv_split_next_first, 10)
  52. DEF(set_i32, 6) /* store the immediate value to a register */
  53. DEF(word_boundary, 1)
  54. DEF(word_boundary_i, 1)
  55. DEF(not_word_boundary, 1)
  56. DEF(not_word_boundary_i, 1)
  57. DEF(back_reference, 2) /* variable length */
  58. DEF(back_reference_i, 2) /* must come after */
  59. DEF(backward_back_reference, 2) /* must come after */
  60. DEF(backward_back_reference_i, 2) /* must come after */
  61. DEF(range, 3) /* variable length */
  62. DEF(range_i, 3) /* variable length */
  63. DEF(range32, 3) /* variable length */
  64. DEF(range32_i, 3) /* variable length */
  65. DEF(lookahead, 5)
  66. DEF(negative_lookahead, 5) /* must come after */
  67. DEF(set_char_pos, 2) /* store the character position to a register */
  68. DEF(check_advance, 2) /* check that the register is different from the character position */
  69. DEF(prev, 1) /* go to the previous char */
  70. #endif /* DEF */