You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

56 regels
1.3 KiB

  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 HAVE_CONFIG_H
  12. # include "config.h"
  13. #endif
  14. #include <string>
  15. #include <lol/engine.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 */