51 wiersze
1.1 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2012 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://sam.zoy.org/projects/COPYING.WTFPL 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. if (parser.parse() != 0)
  28. return false;
  29. return true;
  30. }
  31. void LolFxCompiler::Error(const class location& l, const std::string& m)
  32. {
  33. Log::Error("Syntax error line %d column %d: %s",
  34. l.begin.line, l.begin.column, m.c_str());
  35. }
  36. void LolFxCompiler::Error(const std::string& m)
  37. {
  38. Log::Error("Syntax error: %s", m.c_str());
  39. }
  40. } /* namespace lol */