您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

scenesetup-compiler.cpp 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
  5. // (c) 2013 Sam Hocevar <sam@hocevar.net>
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the Do What The Fuck You Want To
  8. // Public License, Version 2, as published by Sam Hocevar. See
  9. // http://www.wtfpl.net/ for more details.
  10. //
  11. #if defined HAVE_CONFIG_H
  12. # include "config.h"
  13. #endif
  14. #include <string>
  15. #include <lol/main.h>
  16. #include "scenesetup.h"
  17. #include "scenesetup-compiler.h"
  18. namespace lol
  19. {
  20. SceneSetupCompiler::SceneSetupCompiler(SceneSetup &uro)
  21. : m_sstp(uro), m_last_cmd("")
  22. {
  23. }
  24. bool SceneSetupCompiler::ParseString(char const *command)
  25. {
  26. SceneSetupScanner scanner(command);
  27. m_lexer = &scanner;
  28. SceneSetupParser parser(*this);
  29. if (parser.parse() != 0)
  30. {
  31. Log::Debug("Uro source: %s\n", command);
  32. return false;
  33. }
  34. return true;
  35. }
  36. void SceneSetupCompiler::Error(const class location& l, const std::string& m)
  37. {
  38. Log::Error("SceneSetup syntax error line %d column %d: %s\n",
  39. l.begin.line, l.begin.column, m.c_str());
  40. }
  41. void SceneSetupCompiler::Error(const std::string& m)
  42. {
  43. Log::Error("SceneSetup syntax error: %s\n", m.c_str());
  44. }
  45. } /* namespace lol */