MyLang
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
source
parser
myparser_pass_highlight.hpp
Go to the documentation of this file.
1
#ifndef MYPARSER_PASS_HIGHLIGHT_HPP
2
#define MYPARSER_PASS_HIGHLIGHT_HPP
3
4
#include "
myparser_pass.hpp
"
5
6
namespace
myparser {
7
8
/*
9
template <>
10
class Pass<PASS_HIGHLIGHT>: public PassProto<PASS_HIGHLIGHT> {
11
public:
12
inline Pass(std::ostream &target):
13
PassProto<PASS_HIGHLIGHT>(), out(target) {}
14
15
// virtual ~Pass() {}
16
17
void run(const NodeList<> *node) {
18
putMainBegin();
19
20
putName(node->getRuleName());
21
putIndex(node->getIndex());
22
23
std::vector<const Node *> children1;
24
25
if (!optionV) {
26
for (const Node *child: node->getChildren()) {
27
if (!child->empty()) {
28
children1.push_back(child);
29
}
30
}
31
}
32
33
const std::vector<const Node *> &children =
34
optionV ? node->getChildren() : children1;
35
36
if (optionC && children.size() == 1) {
37
putBegin();
38
children[0]->runPass(this);
39
putEnd();
40
} else {
41
putPlaceHolder();
42
43
putLnBegin();
44
++indent;
45
46
bool first = true;
47
for (const Node *child: children) {
48
putLn(first);
49
first = false;
50
child->runPass(this);
51
}
52
53
--indent;
54
putLnEnd();
55
}
56
57
putMainEnd();
58
}
59
60
void run(const NodeText<> *node) {
61
putMainBegin();
62
63
putName(node->getRuleName());
64
65
putBegin();
66
putText(node->getText());
67
putEnd();
68
69
putMainEnd();
70
}
71
72
template <class E>
73
void run(const NodeTextOrError<E> *node) {
74
putMainBegin();
75
76
putName(node->getRuleName());
77
78
putBegin();
79
if (node->accepted()) {
80
putText(node->getText());
81
} else {
82
putError(E::getStr());
83
}
84
putEnd();
85
86
putMainEnd();
87
}
88
89
template <class E>
90
void run(const NodeError<E> *node) {}
91
};*/
92
93
}
94
95
#endif
myparser_pass.hpp
Generated on Thu Nov 27 2014 16:32:26 for MyLang by
1.8.6