Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81568 / c2html / lexconst.h
blob: cfb9e6d1103bef8327193911f9a318d988536f4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef LEXCER_CONST_H
#define LEXCER_CONST_H

namespace LexCer {

static const std::unordered_set<std::string> keywords = 
  {"auto", "register", "static", "extern", "typedef", "struct", "union", "enum",
   "if", "else", "for", "while", "switch", "case", "default", "const", "break",
   "continue", "goto", "sizeof", "alignof", "volatile", "return"};

static const std::unordered_set<std::string> preprocessor =
  {"include", "define", "undef", "if", "ifdef", "ifndef", "else", "elif", "endif",
   "line", "error", "pragma"};

static const std::unordered_map<TokenClass, std::string> tokenToClass
  {
   {
    {TokenClass::Operator, "operator"},
    {TokenClass::Keyword, "keyword"},
    {TokenClass::Typename, "typename"},
    {TokenClass::PreprocessorDirective, "preproc"},
    {TokenClass::Identifier, "identifier"},
    {TokenClass::String, "string"},
    {TokenClass::Comment, "comment"},
    {TokenClass::Number, "number"},
    {TokenClass::Invalid, "invalid"},
    {TokenClass::LeftParen, "identifier"},
    {TokenClass::LeftCurly, "identifier"},
    {TokenClass::RightParen, "identifier"},
    {TokenClass::RightCurly, "identifier"},
    {TokenClass::RightParen, "identifier"}
   }
  };

static const std::string spanBegin = "<span class=\"";
static const std::string spanEnd = "</span>";

static constexpr int MAX_EXP_LEN = 4;

} /* Namespace LexCer */
  
#endif