5
5
* Author: ballance
6
6
*/
7
7
8
+ #include < stdio.h>
8
9
#include " Formatter.h"
9
10
#include " PSSLexer.h"
10
11
#include " PSSParser.h"
11
12
12
13
using namespace antlr4 ;
13
14
15
+ namespace pss {
16
+
14
17
Formatter::Formatter () {
15
18
// TODO Auto-generated constructor stub
16
19
@@ -34,12 +37,35 @@ void Formatter::format(
34
37
parser.compilation_unit ();
35
38
}
36
39
40
+ void Formatter::enterAction_declaration (PSSParser::Action_declarationContext *ctx) {
41
+ fprintf (stdout, " enterAction_declaration %p %s\n " ,
42
+ ctx->start ,
43
+ ctx->start ->getText ().c_str ());
44
+ }
45
+
46
+ void Formatter::exitAction_declaration (PSSParser::Action_declarationContext *ctx) {
47
+ fprintf (stdout, " exitAction_declaration %s\n " , ctx->start ->getText ().c_str ());
48
+ }
49
+
50
+ void Formatter::enterComponent_declaration (PSSParser::Component_declarationContext *ctx) {
51
+ fprintf (stdout, " enterComponent_declaration %p %s\n " ,
52
+ ctx->start ,
53
+ ctx->start ->getText ().c_str ());
54
+ }
55
+
56
+ void Formatter::exitComponent_declaration (PSSParser::Component_declarationContext *ctx) {
57
+ fprintf (stdout, " exitComponent_declaration %s\n " , ctx->start ->getText ().c_str ());
58
+ }
59
+
37
60
void Formatter::visitTerminal (antlr4::tree::TerminalNode *node) {
38
- fprintf (stdout, " visitTerminal: %s\n " , node->getText ().c_str ());
61
+ fprintf (stdout, " visitTerminal: %p %s\n " ,
62
+ node->getSymbol (),
63
+ node->getText ().c_str ());
39
64
40
65
}
41
66
42
67
void Formatter::visitErrorNode (antlr4::tree::ErrorNode *node) {
43
68
fprintf (stdout, " visitErrorNode: %s\n " , node->getText ().c_str ());
44
69
}
45
70
71
+ }
0 commit comments