52 行
1.1 KiB

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