1
2
3
4
5
6 #ifndef SNG2HTML_SNG2HTML_LEXER_CONTEXT_INCLUDED
7 #define SNG2HTML_SNG2HTML_LEXER_CONTEXT_INCLUDED
8 #include <sng2html/sng2html/Symbol.hpp>
9 #include <map>
10
11 namespace sng2html { namespace sng2html {
12
13 enum class IdentifierClassKind
14 {
15 none, unicode, ascii
16 };
17
18 class LexerContext
19 {
20 public:
21 LexerContext(IdentifierClassKind identifierClassKind);
22 ~LexerContext();
23 Symbol* MakeChar(char32_t c);
24 Symbol* MakeAny() { return &any; }
25 Symbol* MakeEpsilon() { return ε }
26 Symbol* MakeRange(char32_t start, char32_t end);
27 Class* MakeIdStart() { return idStart; }
28 Class* MakeIdCont() { return idCont; }
29 Class* MakeClass();
30 private:
31 std::vector<Symbol*> symbols;
32 std::map<char32_t, Symbol*> charSymbols;
33 std::map<Range, Symbol*> rangeSymbols;
34 Any any;
35 Char epsilon;
36 Class* idStart;
37 Class* idCont;
38 };
39
40 } }
41
42 #endif // SNG2HTML_SNG2HTML_LEXER_CONTEXT_INCLUDED