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