1
2
3
4
5
6 [hpp]#include <soulng/cppcode/Literal.hpp>
7 [cpp]#include <sng2html/sng2html/ParserFileLexer.hpp>
8 [cpp]#include <sng2html/sng2html/ParserFileTokens.hpp>
9
10 using namespace soulng::lexer;
11 using namespace ParserFileTokens;
12
13 parser ParserLiteralParser
14 {
15 uselexer ParserFileLexer;
16
17 CppLiteral : soulng::cppcode::Literal*
18 ::= INTLIT{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
19 | FLOATINGLIT{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
20 | CHARLIT{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
21 | STRINGLIT{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
22 | TRUE{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
23 | FALSE{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
24 | NULLPTR{ return new soulng::cppcode::Literal(lexer.GetMatch(span)); }
25 ;
26
27 ruleinfo
28 {
29 (CppLiteral, "C++ literal")
30 }
31 }