File tree Expand file tree Collapse file tree 2 files changed +106
-93
lines changed Expand file tree Collapse file tree 2 files changed +106
-93
lines changed Original file line number Diff line number Diff line change @@ -1147,3 +1147,109 @@ end
11471147 (string
11481148 (literal_content)))))))
11491149 (macro_content))))
1150+
1151+ ========================
1152+ macro var as block param
1153+ :language(crystal)
1154+ ========================
1155+
1156+ {% begin %}
1157+ method do |%buffer|
1158+ puts %buffer
1159+ end
1160+ {% end %}
1161+
1162+ ---
1163+
1164+ (expressions
1165+ (macro_begin
1166+ body: (expressions
1167+ (macro_content)
1168+ (macro_var
1169+ name: (identifier))
1170+ (macro_content)
1171+ (macro_var
1172+ name: (identifier))
1173+ (macro_content))))
1174+
1175+ =============================
1176+ def identifier with macro exp
1177+ :language(crystal)
1178+ =============================
1179+
1180+ {% begin %}
1181+ def hello_{{ "world" }}(a, b)
1182+ end
1183+ {% end %}
1184+
1185+ ---
1186+
1187+ (expressions
1188+ (macro_begin
1189+ body: (expressions
1190+ (macro_content)
1191+ (macro_expression
1192+ (string
1193+ (literal_content)))
1194+ (macro_content))))
1195+
1196+ =====================
1197+ ivar macro expression
1198+ :language(crystal)
1199+ =====================
1200+
1201+ {% begin %}
1202+ @{{ name }} = %bar{name}
1203+ {% end %}
1204+
1205+ ---
1206+
1207+ (expressions
1208+ (macro_begin
1209+ body: (expressions
1210+ (macro_content)
1211+ (macro_expression
1212+ (identifier))
1213+ (macro_content)
1214+ (macro_var
1215+ name: (identifier)
1216+ (identifier))
1217+ (macro_content))))
1218+
1219+ ===============================
1220+ pseudo-methods with macro nodes
1221+ :language(crystal)
1222+ ===============================
1223+
1224+ {% begin %}
1225+ a.is_a?({{type}})
1226+ {% end %}
1227+
1228+ ---
1229+
1230+ (expressions
1231+ (macro_begin
1232+ body: (expressions
1233+ (macro_content)
1234+ (macro_expression
1235+ (identifier))
1236+ (macro_content))))
1237+
1238+ ======================
1239+ macro var in call args
1240+ :language(crystal)
1241+ ======================
1242+
1243+ {% begin %}
1244+ method.call %mvar
1245+ {% end %}
1246+
1247+ ---
1248+
1249+ (expressions
1250+ (macro_begin
1251+ body: (expressions
1252+ (macro_content)
1253+ (macro_var
1254+ name: (identifier))
1255+ (macro_content))))
Original file line number Diff line number Diff line change 6060
6161(expressions)
6262
63- ===============================
64- pseudo-methods with macro nodes
65- :error
66- ===============================
67- a.is_a?({{type}})
68- ---
69-
70- (expressions)
71-
7263============================================
7364macro variables in escaped macro expressions
7465:error
@@ -128,23 +119,6 @@ MyConst2 = {
128119 (symbol)
129120 (symbol))))))))
130121
131- ======================
132- macro var in call args
133- ======================
134-
135- method.call %mvar
136-
137- ---
138-
139- (expressions
140- (call
141- (call
142- (identifier)
143- (identifier))
144- (operator)
145- (argument_list
146- (identifier))))
147-
148122=======================
149123nillable implicit index
150124=======================
@@ -177,73 +151,6 @@ filters1.try(&.pos[name]?)
177151 (identifier)))))
178152 (ERROR))))
179153
180- ========================
181- macro var as block param
182- :error
183- ========================
184-
185- method do |%buffer|
186- puts %buffer
187- end
188-
189- ---
190-
191- (expressions
192- (call
193- method: (identifier)
194- block: (block
195- (ERROR)
196- body: (expressions
197- (call
198- receiver: (macro_var
199- name: (identifier))
200- method: (operator)
201- arguments: (argument_list
202- (call
203- receiver: (identifier)
204- method: (operator)
205- arguments: (argument_list
206- (identifier)))))))))
207-
208- =============================
209- def identifier with macro exp
210- :error
211- =============================
212-
213- def hello_{{ "world" }}(a, b)
214- end
215-
216- ---
217-
218- (expressions
219- (method_def
220- (identifier)
221- (ERROR
222- (macro_expression
223- (string))
224- (ERROR
225- (identifier))
226- (identifier))))
227-
228- =====================
229- ivar macro expression
230- :error
231- =====================
232-
233- @{{ name }} = %bar{name}
234-
235- ---
236-
237- (expressions
238- (ERROR
239- (UNEXPECTED '{'))
240- (assign
241- (macro_expression
242- (identifier))
243- (macro_var
244- (identifier)
245- (identifier)))
246-
247154=================================
248155percent literals in macro content
249156=================================
You can’t perform that action at this time.
0 commit comments