This repository was archived by the owner on Apr 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_grammar.h
More file actions
51 lines (38 loc) · 1.58 KB
/
python_grammar.h
File metadata and controls
51 lines (38 loc) · 1.58 KB
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
43
44
45
46
47
48
49
50
51
#pragma once
#include <boost/spirit/include/qi_grammar.hpp>
#include <boost/spirit/include/qi_rule.hpp>
#include <string>
#include "parse.h"
#include "lexeme.h"
namespace sap
{
namespace qi = boost::spirit::qi;
struct PythonGrammar : qi::grammar< Iterator, Lexems() >
{
qi::rule< Iterator, void() > indent;
qi::rule< Iterator, uint() > indent_level;
qi::rule< Iterator, lex::type() > indent_type;
qi::rule< Iterator, lex() > indent_rule;
qi::rule< Iterator, lex::type() > symbol_type;
qi::rule< Iterator, lex::symbol() > symbol;
qi::rule< Iterator, lex() > symbol_rule;
qi::rule< Iterator, lex::type() > reserved_type;
qi::rule< Iterator, lex::reserved_word() > reserved;
qi::rule< Iterator, lex() > reserved_rule;
qi::rule< Iterator, lex::type() > identifier_type;
qi::rule< Iterator, std::string() > identifier;
qi::rule< Iterator, lex() > identifier_rule;
qi::rule< Iterator, lex::type() > s_type;
qi::rule< Iterator, lex::type() > b_type;
qi::rule< Iterator, lex::type() > d_type;
qi::rule< Iterator, std::string() > string_constant;
qi::rule< Iterator, double() > double_constant;
qi::rule< Iterator, bool() > bool_constant;
qi::rule< Iterator, lex() > constant_rule;
qi::rule< Iterator, lex() > visible_lexeme;
qi::rule< Iterator, void() > empty_line;
qi::rule< Iterator, Lexems() > non_empty_line;
qi::rule< Iterator, Lexems() > start;
PythonGrammar( );
}; // struct PythonGrammar
} // namespace sap