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.
 
 
 

62 regels
1.5 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. #ifndef __EASYMESH_COMPILER_H__
  13. #define __EASYMESH_COMPILER_H__
  14. #include <string>
  15. #ifndef __FLEX_LEXER_H
  16. # define yyFlexLexer EasyMeshFlexLexer
  17. # include "FlexLexer.h"
  18. # undef yyFlexLexer
  19. #endif
  20. #include "generated/easymesh-parser.h"
  21. class EasyMesh;
  22. namespace lol
  23. {
  24. class EasyMeshScanner : public EasyMeshFlexLexer
  25. {
  26. public:
  27. EasyMeshScanner(char const *command);
  28. virtual ~EasyMeshScanner();
  29. virtual int LexerInput(char* buf, int max_size);
  30. virtual EasyMeshParser::token_type lex(EasyMeshParser::semantic_type* yylval,
  31. EasyMeshParser::location_type* yylloc);
  32. private:
  33. char const *m_input;
  34. };
  35. class EasyMeshCompiler
  36. {
  37. public:
  38. EasyMeshCompiler(class EasyMesh &mesh);
  39. bool ParseString(char const *command);
  40. void Error(const class location& l, const std::string& m);
  41. void Error(const std::string& m);
  42. class EasyMeshScanner* m_lexer;
  43. class EasyMesh &m_mesh;
  44. };
  45. } /* namespace lol */
  46. #endif /* __EASYMESH_COMPILER_H__ */