parser.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _TORQUESCRIPT_PARSER_H_
  2. #define _TORQUESCRIPT_PARSER_H_
  3. #include <cstdio>
  4. #include "platform/types.h"
  5. const char* CMDGetCurrentFile();
  6. S32 CMDGetCurrentLine();
  7. S32 CMDparse();
  8. void CMDrestart(FILE* in);
  9. void CMDSetScanBuffer(const char *sb, const char *fn);
  10. extern void expandEscape(char *dest, const char *src);
  11. extern bool collapseEscape(char *buf);
  12. class TorqueScriptParser
  13. {
  14. public:
  15. TorqueScriptParser() = default;
  16. const char* mExtension;
  17. //-----------------------------------------------------------------------------
  18. /// \brief Function for GetCurrentFile from the lexer
  19. //-----------------------------------------------------------------------------
  20. const char* getCurrentFile() { return CMDGetCurrentFile(); }
  21. //-----------------------------------------------------------------------------
  22. /// \brief Function for GetCurrentLine from the lexer
  23. //-----------------------------------------------------------------------------
  24. S32 getCurrentLine() { return CMDGetCurrentLine(); }
  25. //-----------------------------------------------------------------------------
  26. /// \brief Function for Parse from the lexer
  27. //-----------------------------------------------------------------------------
  28. S32 parse() { return CMDparse(); }
  29. //-----------------------------------------------------------------------------
  30. /// \brief Function for Restart from the lexer
  31. //-----------------------------------------------------------------------------
  32. void restart(FILE *pInputFile) { CMDrestart(pInputFile); }
  33. //-----------------------------------------------------------------------------
  34. /// \brief Function for SetScanBuffer from the lexer
  35. //-----------------------------------------------------------------------------
  36. void setScanBuffer(const char* sb, const char* fn) { CMDSetScanBuffer(sb, fn); }
  37. };
  38. #endif