@@ -65,11 +65,11 @@ def parse_function_body(name, text, resolve, source, anon_name, parent):
65
65
) = m .groups ()
66
66
67
67
if empty :
68
- log_match ('' , m )
68
+ log_match ('' , m , depth )
69
69
resolve (None , None , None , text )
70
70
yield None , text
71
71
elif inline_kind :
72
- log_match ('' , m )
72
+ log_match ('' , m , depth )
73
73
kind = inline_kind
74
74
name = inline_name or anon_name ('inline-' )
75
75
data = [] # members
@@ -92,7 +92,7 @@ def parse_function_body(name, text, resolve, source, anon_name, parent):
92
92
# XXX Should "parent" really be None for inline type decls?
93
93
yield resolve (kind , data , name , text , None ), text
94
94
elif block_close :
95
- log_match ('' , m )
95
+ log_match ('' , m , depth )
96
96
depth -= 1
97
97
resolve (None , None , None , text )
98
98
# XXX This isn't great. Calling resolve() should have
@@ -101,13 +101,13 @@ def parse_function_body(name, text, resolve, source, anon_name, parent):
101
101
# needs to be fixed.
102
102
yield None , text
103
103
elif compound_bare :
104
- log_match ('' , m )
104
+ log_match ('' , m , depth )
105
105
yield resolve ('statement' , compound_bare , None , text , parent ), text
106
106
elif compound_labeled :
107
- log_match ('' , m )
107
+ log_match ('' , m , depth )
108
108
yield resolve ('statement' , compound_labeled , None , text , parent ), text
109
109
elif compound_paren :
110
- log_match ('' , m )
110
+ log_match ('' , m , depth )
111
111
try :
112
112
pos = match_paren (text )
113
113
except ValueError :
@@ -132,7 +132,7 @@ def parse_function_body(name, text, resolve, source, anon_name, parent):
132
132
}
133
133
yield resolve ('statement' , data , None , text , parent ), text
134
134
elif block_open :
135
- log_match ('' , m )
135
+ log_match ('' , m , depth )
136
136
depth += 1
137
137
if block_leading :
138
138
# An inline block: the last evaluated expression is used
@@ -144,10 +144,10 @@ def parse_function_body(name, text, resolve, source, anon_name, parent):
144
144
resolve (None , None , None , text )
145
145
yield None , text
146
146
elif simple_ending :
147
- log_match ('' , m )
147
+ log_match ('' , m , depth )
148
148
yield resolve ('statement' , simple_stmt , None , text , parent ), text
149
149
elif var_ending :
150
- log_match ('' , m )
150
+ log_match ('' , m , depth )
151
151
kind = 'variable'
152
152
_ , name , vartype = parse_var_decl (decl )
153
153
data = {
@@ -220,7 +220,7 @@ def _parse_next_local_static(m, srcinfo, anon_name, func, depth):
220
220
remainder = srcinfo .text [m .end ():]
221
221
222
222
if inline_kind :
223
- log_match ('func inline' , m )
223
+ log_match ('func inline' , m , depth , depth )
224
224
kind = inline_kind
225
225
name = inline_name or anon_name ('inline-' )
226
226
# Immediately emit a forward declaration.
@@ -249,7 +249,7 @@ def parse_body(source):
249
249
yield parse_body , depth
250
250
251
251
elif static_decl :
252
- log_match ('local variable' , m )
252
+ log_match ('local variable' , m , depth , depth )
253
253
_ , name , data = parse_var_decl (static_decl )
254
254
255
255
yield srcinfo .resolve ('variable' , data , name , parent = func ), depth
@@ -266,10 +266,13 @@ def parse_body(source):
266
266
else :
267
267
log_match ('func other' , m )
268
268
if block_open :
269
+ log_match ('func other' , None , depth , depth + 1 )
269
270
depth += 1
270
271
elif block_close :
272
+ log_match ('func other' , None , depth , depth - 1 )
271
273
depth -= 1
272
274
elif stmt_end :
275
+ log_match ('func other' , None , depth , depth )
273
276
pass
274
277
else :
275
278
# This should be unreachable.
0 commit comments