1
2
3
4
5
6 #include <sng2html/sng2html/TokenValueParsers.hpp>
7
8 classmap ProjectFileClassMap;
9
10 prefix "sng2html/sng2html";
11
12 tokens ProjectFileTokens
13 {
14 (PROJECT, "'project'"), (SOURCE, "'source'"), (ID, "identifier"), (FILEPATH, "file path"), (DOT, "'.'"), (SEMICOLON, "';'")
15 }
16
17 keywords ProjectFileKeywords
18 {
19 ("project", PROJECT), ("source", SOURCE)
20 }
21
22 expressions
23 {
24 ws = "[\n\r\t ]";
25 newline = "\r\n|\n|\r";
26 linecomment = "//[^\n\r]*{newline}";
27 blockcomment = "/\*([^*]|\*[^/])*\*/";
28 comment = "{linecomment}|{blockcomment}";
29 separators = "({ws}|{comment})+";
30 id = "{idstart}{idcont}*";
31 filepath = "<[^\n>]*>";
32 }
33
34 lexer ProjectFileLexer
35 {
36 "{separators}" {}
37 "{id}" { int kw = GetKeywordToken(token.match); if (kw == INVALID_TOKEN) return ID; else return kw; }
38 "{filepath}" { filePath = sng2html::sng2html::MakeFilePath(FileName(), token); return FILEPATH; }
39 "\." { return DOT; }
40 ";" { return SEMICOLON; }
41
42 variables
43 {
44 std::string filePath;
45 }
46 }