vmfparser.h 657 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "common.h"
  3. struct VMFState;
  4. typedef struct VMFState VMFState;
  5. typedef enum {
  6. VMFEntryType_KeyValue,
  7. VMFEntryType_SectionOpen,
  8. VMFEntryType_SectionClose
  9. } VMFEntryType;
  10. typedef enum {
  11. VMFAction_Continue,
  12. VMFAction_Exit,
  13. VMFAction_SemanticError
  14. } VMFAction;
  15. typedef struct {
  16. StringView key, value;
  17. } VMFKeyValue;
  18. typedef VMFAction (*VMFCallback)(VMFState *state, VMFEntryType entry, const VMFKeyValue *kv);
  19. struct VMFState {
  20. void *user_data;
  21. StringView data;
  22. VMFCallback callback;
  23. };
  24. typedef enum {
  25. VMFResult_Success,
  26. VMFResult_SyntaxError,
  27. VMFResult_SemanticError
  28. } VMFResult;
  29. VMFResult vmfParse(VMFState *state);