cmListFileLexer.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmListFileLexer_h
  11. #define cmListFileLexer_h
  12. typedef enum cmListFileLexer_Type_e
  13. {
  14. cmListFileLexer_Token_None,
  15. cmListFileLexer_Token_Space,
  16. cmListFileLexer_Token_Newline,
  17. cmListFileLexer_Token_Identifier,
  18. cmListFileLexer_Token_ParenLeft,
  19. cmListFileLexer_Token_ParenRight,
  20. cmListFileLexer_Token_ArgumentUnquoted,
  21. cmListFileLexer_Token_ArgumentQuoted,
  22. cmListFileLexer_Token_ArgumentBracket,
  23. cmListFileLexer_Token_CommentBracket,
  24. cmListFileLexer_Token_BadCharacter,
  25. cmListFileLexer_Token_BadBracket,
  26. cmListFileLexer_Token_BadString
  27. } cmListFileLexer_Type;
  28. typedef struct cmListFileLexer_Token_s cmListFileLexer_Token;
  29. struct cmListFileLexer_Token_s
  30. {
  31. cmListFileLexer_Type type;
  32. char* text;
  33. int length;
  34. int line;
  35. int column;
  36. };
  37. enum cmListFileLexer_BOM_e
  38. {
  39. cmListFileLexer_BOM_None,
  40. cmListFileLexer_BOM_UTF8,
  41. cmListFileLexer_BOM_UTF16BE,
  42. cmListFileLexer_BOM_UTF16LE,
  43. cmListFileLexer_BOM_UTF32BE,
  44. cmListFileLexer_BOM_UTF32LE
  45. };
  46. typedef enum cmListFileLexer_BOM_e cmListFileLexer_BOM;
  47. typedef struct cmListFileLexer_s cmListFileLexer;
  48. #ifdef __cplusplus
  49. extern "C"
  50. {
  51. #endif
  52. cmListFileLexer* cmListFileLexer_New();
  53. int cmListFileLexer_SetFileName(cmListFileLexer*, const char*,
  54. cmListFileLexer_BOM* bom);
  55. int cmListFileLexer_SetString(cmListFileLexer*, const char*);
  56. cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer*);
  57. long cmListFileLexer_GetCurrentLine(cmListFileLexer*);
  58. long cmListFileLexer_GetCurrentColumn(cmListFileLexer*);
  59. const char* cmListFileLexer_GetTypeAsString(cmListFileLexer*,
  60. cmListFileLexer_Type);
  61. void cmListFileLexer_Delete(cmListFileLexer*);
  62. #ifdef __cplusplus
  63. } /* extern "C" */
  64. #endif
  65. #endif