1
2
3
4
5
6 [hpp]#include <sng2html/sng2html/ProjectFile.hpp>
7 [hpp]#include <memory>
8 [cpp]#include <sng2html/sng2html/ProjectFileLexer.hpp>
9 [cpp]#include <sng2html/sng2html/ProjectFileTokens.hpp>
10
11 using namespace soulng::lexer;
12 using namespace ProjectFileTokens;
13
14 parser ProjectFileParser
15 {
16 uselexer ProjectFileLexer;
17 main;
18
19 ProjectFile(var std::unique_ptr projectFile) : sng2html::sng2html::ProjectFile*
20 ::= PROJECT QualifiedId:projectName! SEMICOLON!{ projectFile.reset(new sng2html::sng2html::ProjectFile(lexer.FileName(), projectName)); } ProjectFileContent(projectFile.get()):content
21 {
22 return projectFile.release();
23 }
24 ;
25
26 ProjectFileContent(sng2html::sng2html::ProjectFile* projectFile)
27 ::= SourceFile(projectFile):sourceFile*
28 ;
29
30 QualifiedId(var Span s) : std::u32string
31 ::= (ID{ s = span; } (DOT ID{ s.end = span.end; })*){ return lexer.GetMatch(s); }
32 ;
33
34 SourceFile(sng2html::sng2html::ProjectFile* projectFile)
35 ::= SOURCE FILEPATH!{ projectFile->AddSourceFile(lexer.filePath); } SEMICOLON!
36 ;
37 }