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.

53 lines
1.2 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
  5. // (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
  6. // (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
  7. // This program is free software; you can redistribute it and/or
  8. // modify it under the terms of the Do What The Fuck You Want To
  9. // Public License, Version 2, as published by Sam Hocevar. See
  10. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  11. //
  12. #if defined HAVE_CONFIG_H
  13. # include "config.h"
  14. #endif
  15. #include <string>
  16. #include "core.h"
  17. #include "easymesh/easymesh-compiler.h"
  18. namespace lol
  19. {
  20. EasyMeshCompiler::EasyMeshCompiler(EasyMesh &mesh)
  21. : m_mesh(mesh)
  22. {
  23. }
  24. bool EasyMeshCompiler::ParseString(char const *command)
  25. {
  26. EasyMeshScanner scanner(command);
  27. m_lexer = &scanner;
  28. EasyMeshParser parser(*this);
  29. if (parser.parse() != 0)
  30. return false;
  31. return true;
  32. }
  33. void EasyMeshCompiler::Error(const class location& l, const std::string& m)
  34. {
  35. Log::Error("Syntax error line %d column %d: %s",
  36. l.begin.line, l.begin.column, m.c_str());
  37. }
  38. void EasyMeshCompiler::Error(const std::string& m)
  39. {
  40. Log::Error("Syntax error: %s", m.c_str());
  41. }
  42. } /* namespace lol */