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.

scenesetup-compiler.h 1.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
  5. // (c) 2013 Sam Hocevar <sam@hocevar.net>
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the Do What The Fuck You Want To
  8. // Public License, Version 2, as published by Sam Hocevar. See
  9. // http://www.wtfpl.net/ for more details.
  10. //
  11. #pragma once
  12. #include <string>
  13. #ifndef __FLEX_LEXER_H
  14. # define yyFlexLexer SceneSetupFlexLexer
  15. # include "FlexLexer.h"
  16. # undef yyFlexLexer
  17. #endif
  18. #include "generated/scenesetup-parser.h"
  19. class SceneSetup;
  20. namespace lol
  21. {
  22. //----
  23. class SceneSetupScanner : public SceneSetupFlexLexer
  24. {
  25. public:
  26. SceneSetupScanner(char const *command);
  27. virtual ~SceneSetupScanner();
  28. virtual int LexerInput(char* buf, int max_size);
  29. virtual SceneSetupParser::token_type lex(SceneSetupParser::semantic_type* yylval,
  30. SceneSetupParser::location_type* yylloc);
  31. private:
  32. char const *m_input;
  33. };
  34. //----
  35. class SceneSetupCompiler
  36. {
  37. public:
  38. SceneSetupCompiler(class SceneSetup &uro);
  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 SceneSetupScanner* m_lexer;
  43. class SceneSetup& m_sstp;
  44. String m_last_cmd;
  45. };
  46. } /* namespace lol */