Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

72 Zeilen
1.5 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 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://www.wtfpl.net/ for more details.
  9. //
  10. #ifndef __LOLFX_COMPILER_H__
  11. #define __LOLFX_COMPILER_H__
  12. #include <string>
  13. #ifndef __FLEX_LEXER_H
  14. # define yyFlexLexer LolFxFlexLexer
  15. # include "FlexLexer.h"
  16. # undef yyFlexLexer
  17. #endif
  18. #include "generated/lolfx-parser.h"
  19. class LolFx;
  20. namespace lol
  21. {
  22. class LolFxScanner : public LolFxFlexLexer
  23. {
  24. public:
  25. LolFxScanner(char const *command);
  26. virtual ~LolFxScanner();
  27. virtual int LexerInput(char* buf, int max_size);
  28. virtual LolFxParser::token_type lex(LolFxParser::semantic_type* yylval,
  29. LolFxParser::location_type* yylloc);
  30. private:
  31. bool IsExpressionTrue(char const *buf);
  32. Map<String, String> m_pp_defines;
  33. enum
  34. {
  35. BlockIsFalse,
  36. BlockIsForeverFalse,
  37. BlockIsTrue,
  38. };
  39. Array<int> m_pp_stack;
  40. char const *m_input;
  41. };
  42. class LolFxCompiler
  43. {
  44. public:
  45. LolFxCompiler(class LolFx &lolfx);
  46. bool ParseString(char const *command);
  47. void Error(const class location& l, const std::string& m);
  48. void Error(const std::string& m);
  49. class LolFxScanner *m_lexer;
  50. class LolFx &m_lolfx;
  51. };
  52. } /* namespace lol */
  53. #endif /* __LOLFX_COMPILER_H__ */