You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.9 KiB

4 years ago
  1. /*
  2. * Summary: API to build regexp automata
  3. * Description: the API to build regexp automata
  4. *
  5. * Copy: See Copyright for the status of this software.
  6. *
  7. * Author: Daniel Veillard
  8. */
  9. #ifndef __XML_AUTOMATA_H__
  10. #define __XML_AUTOMATA_H__
  11. #include <libxml/xmlversion.h>
  12. #include <libxml/tree.h>
  13. #ifdef LIBXML_REGEXP_ENABLED
  14. #ifdef LIBXML_AUTOMATA_ENABLED
  15. #include <libxml/xmlregexp.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * xmlAutomataPtr:
  21. *
  22. * A libxml automata description, It can be compiled into a regexp
  23. */
  24. typedef struct _xmlAutomata xmlAutomata;
  25. typedef xmlAutomata *xmlAutomataPtr;
  26. /**
  27. * xmlAutomataStatePtr:
  28. *
  29. * A state int the automata description,
  30. */
  31. typedef struct _xmlAutomataState xmlAutomataState;
  32. typedef xmlAutomataState *xmlAutomataStatePtr;
  33. /*
  34. * Building API
  35. */
  36. XMLPUBFUN xmlAutomataPtr XMLCALL
  37. xmlNewAutomata (void);
  38. XMLPUBFUN void XMLCALL
  39. xmlFreeAutomata (xmlAutomataPtr am);
  40. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  41. xmlAutomataGetInitState (xmlAutomataPtr am);
  42. XMLPUBFUN int XMLCALL
  43. xmlAutomataSetFinalState (xmlAutomataPtr am,
  44. xmlAutomataStatePtr state);
  45. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  46. xmlAutomataNewState (xmlAutomataPtr am);
  47. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  48. xmlAutomataNewTransition (xmlAutomataPtr am,
  49. xmlAutomataStatePtr from,
  50. xmlAutomataStatePtr to,
  51. const xmlChar *token,
  52. void *data);
  53. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  54. xmlAutomataNewTransition2 (xmlAutomataPtr am,
  55. xmlAutomataStatePtr from,
  56. xmlAutomataStatePtr to,
  57. const xmlChar *token,
  58. const xmlChar *token2,
  59. void *data);
  60. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  61. xmlAutomataNewNegTrans (xmlAutomataPtr am,
  62. xmlAutomataStatePtr from,
  63. xmlAutomataStatePtr to,
  64. const xmlChar *token,
  65. const xmlChar *token2,
  66. void *data);
  67. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  68. xmlAutomataNewCountTrans (xmlAutomataPtr am,
  69. xmlAutomataStatePtr from,
  70. xmlAutomataStatePtr to,
  71. const xmlChar *token,
  72. int min,
  73. int max,
  74. void *data);
  75. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  76. xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
  77. xmlAutomataStatePtr from,
  78. xmlAutomataStatePtr to,
  79. const xmlChar *token,
  80. const xmlChar *token2,
  81. int min,
  82. int max,
  83. void *data);
  84. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  85. xmlAutomataNewOnceTrans (xmlAutomataPtr am,
  86. xmlAutomataStatePtr from,
  87. xmlAutomataStatePtr to,
  88. const xmlChar *token,
  89. int min,
  90. int max,
  91. void *data);
  92. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  93. xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
  94. xmlAutomataStatePtr from,
  95. xmlAutomataStatePtr to,
  96. const xmlChar *token,
  97. const xmlChar *token2,
  98. int min,
  99. int max,
  100. void *data);
  101. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  102. xmlAutomataNewAllTrans (xmlAutomataPtr am,
  103. xmlAutomataStatePtr from,
  104. xmlAutomataStatePtr to,
  105. int lax);
  106. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  107. xmlAutomataNewEpsilon (xmlAutomataPtr am,
  108. xmlAutomataStatePtr from,
  109. xmlAutomataStatePtr to);
  110. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  111. xmlAutomataNewCountedTrans (xmlAutomataPtr am,
  112. xmlAutomataStatePtr from,
  113. xmlAutomataStatePtr to,
  114. int counter);
  115. XMLPUBFUN xmlAutomataStatePtr XMLCALL
  116. xmlAutomataNewCounterTrans (xmlAutomataPtr am,
  117. xmlAutomataStatePtr from,
  118. xmlAutomataStatePtr to,
  119. int counter);
  120. XMLPUBFUN int XMLCALL
  121. xmlAutomataNewCounter (xmlAutomataPtr am,
  122. int min,
  123. int max);
  124. XMLPUBFUN xmlRegexpPtr XMLCALL
  125. xmlAutomataCompile (xmlAutomataPtr am);
  126. XMLPUBFUN int XMLCALL
  127. xmlAutomataIsDeterminist (xmlAutomataPtr am);
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* LIBXML_AUTOMATA_ENABLED */
  132. #endif /* LIBXML_REGEXP_ENABLED */
  133. #endif /* __XML_AUTOMATA_H__ */