1grammar t050decorate;
2options {
3  language =Cpp;
4}
5
6@lexer::includes
7{
8#include "UserTestTraits.hpp"
9}
10@lexer::namespace
11{ Antlr3Test }
12
13@parser::includes {
14#include "UserTestTraits.hpp"
15}
16@parser::namespace
17{ Antlr3Test }
18
19@header {
20    def logme(func):
21        def decorated(self, *args, **kwargs):
22            self.events.append('before')
23            try:
24                return func(self, *args, **kwargs)
25            finally:
26                self.events.append('after')
27
28        return decorated
29}
30
31@parser::init {
32self.events = []
33}
34
35document
36@decorate {
37    @logme
38}
39    : IDENTIFIER
40    ;
41
42IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
43