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 line
1.3 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr>
  6. // (c) 2009-2013 Benjamin "Touky" 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://www.wtfpl.net/ 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. {
  31. Log::Debug("Mesh source: %s\n", command);
  32. return false;
  33. }
  34. return true;
  35. }
  36. void EasyMeshCompiler::Error(const class location& l, const std::string& m)
  37. {
  38. Log::Error("EasyMesh syntax error line %d column %d: %s\n",
  39. l.begin.line, l.begin.column, m.c_str());
  40. }
  41. void EasyMeshCompiler::Error(const std::string& m)
  42. {
  43. Log::Error("EasyMesh syntax error: %s\n", m.c_str());
  44. }
  45. } /* namespace lol */