cmListFileLexer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include <stddef.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /* NOLINTNEXTLINE(modernize-use-using) */
  9. typedef enum cmListFileLexer_Type_e
  10. {
  11. cmListFileLexer_Token_None,
  12. cmListFileLexer_Token_Space,
  13. cmListFileLexer_Token_Newline,
  14. cmListFileLexer_Token_Identifier,
  15. cmListFileLexer_Token_ParenLeft,
  16. cmListFileLexer_Token_ParenRight,
  17. cmListFileLexer_Token_ArgumentUnquoted,
  18. cmListFileLexer_Token_ArgumentQuoted,
  19. cmListFileLexer_Token_ArgumentBracket,
  20. cmListFileLexer_Token_CommentBracket,
  21. cmListFileLexer_Token_BadCharacter,
  22. cmListFileLexer_Token_BadBracket,
  23. cmListFileLexer_Token_BadString
  24. } cmListFileLexer_Type;
  25. /* NOLINTNEXTLINE(modernize-use-using) */
  26. typedef struct cmListFileLexer_Token_s cmListFileLexer_Token;
  27. struct cmListFileLexer_Token_s
  28. {
  29. cmListFileLexer_Type type;
  30. char* text;
  31. size_t length;
  32. int line;
  33. int column;
  34. };
  35. enum cmListFileLexer_BOM_e
  36. {
  37. cmListFileLexer_BOM_None,
  38. cmListFileLexer_BOM_UTF8,
  39. cmListFileLexer_BOM_UTF16BE,
  40. cmListFileLexer_BOM_UTF16LE,
  41. cmListFileLexer_BOM_UTF32BE,
  42. cmListFileLexer_BOM_UTF32LE
  43. };
  44. /* NOLINTNEXTLINE(modernize-use-using) */
  45. typedef enum cmListFileLexer_BOM_e cmListFileLexer_BOM;
  46. /* NOLINTNEXTLINE(modernize-use-using) */
  47. typedef struct cmListFileLexer_s cmListFileLexer;
  48. cmListFileLexer* cmListFileLexer_New(void);
  49. int cmListFileLexer_SetFileName(cmListFileLexer*, char const*,
  50. cmListFileLexer_BOM* bom);
  51. int cmListFileLexer_SetString(cmListFileLexer*, char const*, size_t);
  52. cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer*);
  53. long cmListFileLexer_GetCurrentLine(cmListFileLexer*);
  54. long cmListFileLexer_GetCurrentColumn(cmListFileLexer*);
  55. char const* cmListFileLexer_GetTypeAsString(cmListFileLexer*,
  56. cmListFileLexer_Type);
  57. void cmListFileLexer_Delete(cmListFileLexer*);
  58. #ifdef __cplusplus
  59. } /* extern "C" */
  60. #endif