Debian Codegraph @

tests/snippets/c/test_function_comments.txt

raw
1 ---input---
2 int func1(int x, int y)
3 /*@requires y >= 0*/
4 {
5 return x / y;
6 }
7
8
9 int func2(int x, int y) //@requires y >= 0;
10 {
11 return x / y;
12 }
13
14
15 void func3()
16 //#test{};
17 {
18 fun(2,3)//test1;
19 ;
20 }
21
22
23 int func4(int x, int y)
24 /*@requires y >= 0;*/
25 {
26 return x / y;
27 }
28
29
30 int func5(int x, int y)
31 /*@requires y >= 0
32 {
33 return x / y;
34 }
35 */
36 {
37 return 2;
38 }
39
40
41 //@requires y >= 0;
42 //@requires y >= 0
43 /*
44 calling(2,5)
45 */
46 /*
47 calling(2,5);
48 */
49 int func6(int x, int y)
50 //@requires y >= 0
51 //@requires y >= 0;
52 /*
53 hello(2,3);
54 */
55 /*
56 hello(2,3)
57 */
58 {
59 // haha(2,3);
60 return x / y;
61 /*
62 callblabla(x, y);
63 */
64 }
65 //@requires y >= 0;
66 //@requires y >= 0
67 /*
68 calling(2,5)
69 */
70 /*
71 calling(2,5);
72 */
73
74
75 int * //@# a pointer to int
76 func7 /* @# why a comment here? */ (
77 int /* the index has to be an int */ a, // index into the array
78 int *b //the array @!
79 )
80 /*
81 The end of the func params @ (@ will result error if parsed incorrectly)
82 */
83 {
84 // yet another comment
85 return b[a];
86 }
87
88 ---tokens---
89 'int' Keyword.Type
90 ' ' Text.Whitespace
91 'func1' Name.Function
92 '(' Punctuation
93 'int' Keyword.Type
94 ' ' Text.Whitespace
95 'x' Name
96 ',' Punctuation
97 ' ' Text.Whitespace
98 'int' Keyword.Type
99 ' ' Text.Whitespace
100 'y' Name
101 ')' Punctuation
102 '\n' Text.Whitespace
103
104 ' ' Text.Whitespace
105 '/*@requires y >= 0*/' Comment.Multiline
106 '\n' Text.Whitespace
107
108 '{' Punctuation
109 '\n' Text.Whitespace
110
111 ' ' Text.Whitespace
112 'return' Keyword
113 ' ' Text.Whitespace
114 'x' Name
115 ' ' Text.Whitespace
116 '/' Operator
117 ' ' Text.Whitespace
118 'y' Name
119 ';' Punctuation
120 '\n' Text.Whitespace
121
122 '}' Punctuation
123 '\n' Text.Whitespace
124
125 '\n' Text.Whitespace
126
127 '\n' Text.Whitespace
128
129 'int' Keyword.Type
130 ' ' Text.Whitespace
131 'func2' Name.Function
132 '(' Punctuation
133 'int' Keyword.Type
134 ' ' Text.Whitespace
135 'x' Name
136 ',' Punctuation
137 ' ' Text.Whitespace
138 'int' Keyword.Type
139 ' ' Text.Whitespace
140 'y' Name
141 ')' Punctuation
142 ' ' Text.Whitespace
143 '//@requires y >= 0;\n' Comment.Single
144
145 '{' Punctuation
146 '\n' Text.Whitespace
147
148 ' ' Text.Whitespace
149 'return' Keyword
150 ' ' Text.Whitespace
151 'x' Name
152 ' ' Text.Whitespace
153 '/' Operator
154 ' ' Text.Whitespace
155 'y' Name
156 ';' Punctuation
157 '\n' Text.Whitespace
158
159 '}' Punctuation
160 '\n' Text.Whitespace
161
162 '\n' Text.Whitespace
163
164 '\n' Text.Whitespace
165
166 'void' Keyword.Type
167 ' ' Text.Whitespace
168 'func3' Name.Function
169 '(' Punctuation
170 ')' Punctuation
171 '\n' Text.Whitespace
172
173 '//#test{};\n' Comment.Single
174
175 '{' Punctuation
176 '\n' Text.Whitespace
177
178 ' ' Text.Whitespace
179 'fun' Name
180 '(' Punctuation
181 '2' Literal.Number.Integer
182 ',' Punctuation
183 '3' Literal.Number.Integer
184 ')' Punctuation
185 '//test1;\n' Comment.Single
186
187 ' ' Text.Whitespace
188 ';' Punctuation
189 '\n' Text.Whitespace
190
191 '}' Punctuation
192 '\n' Text.Whitespace
193
194 '\n' Text.Whitespace
195
196 '\n' Text.Whitespace
197
198 'int' Keyword.Type
199 ' ' Text.Whitespace
200 'func4' Name.Function
201 '(' Punctuation
202 'int' Keyword.Type
203 ' ' Text.Whitespace
204 'x' Name
205 ',' Punctuation
206 ' ' Text.Whitespace
207 'int' Keyword.Type
208 ' ' Text.Whitespace
209 'y' Name
210 ')' Punctuation
211 '\n' Text.Whitespace
212
213 ' ' Text.Whitespace
214 '/*@requires y >= 0;*/' Comment.Multiline
215 '\n' Text.Whitespace
216
217 '{' Punctuation
218 '\n' Text.Whitespace
219
220 ' ' Text.Whitespace
221 'return' Keyword
222 ' ' Text.Whitespace
223 'x' Name
224 ' ' Text.Whitespace
225 '/' Operator
226 ' ' Text.Whitespace
227 'y' Name
228 ';' Punctuation
229 '\n' Text.Whitespace
230
231 '}' Punctuation
232 '\n' Text.Whitespace
233
234 '\n' Text.Whitespace
235
236 '\n' Text.Whitespace
237
238 'int' Keyword.Type
239 ' ' Text.Whitespace
240 'func5' Name.Function
241 '(' Punctuation
242 'int' Keyword.Type
243 ' ' Text.Whitespace
244 'x' Name
245 ',' Punctuation
246 ' ' Text.Whitespace
247 'int' Keyword.Type
248 ' ' Text.Whitespace
249 'y' Name
250 ')' Punctuation
251 '\n' Text.Whitespace
252
253 ' ' Text.Whitespace
254 '/*@requires y >= 0\n {\n return x / y;\n }\n */' Comment.Multiline
255 '\n' Text.Whitespace
256
257 ' ' Text.Whitespace
258 '{' Punctuation
259 '\n' Text.Whitespace
260
261 ' ' Text.Whitespace
262 'return' Keyword
263 ' ' Text.Whitespace
264 '2' Literal.Number.Integer
265 ';' Punctuation
266 '\n' Text.Whitespace
267
268 ' ' Text.Whitespace
269 '}' Punctuation
270 '\n' Text.Whitespace
271
272 '\n' Text.Whitespace
273
274 '\n' Text.Whitespace
275
276 '//@requires y >= 0;\n' Comment.Single
277
278 '//@requires y >= 0\n' Comment.Single
279
280 '/*\ncalling(2,5)\n*/' Comment.Multiline
281 '\n' Text.Whitespace
282
283 '/*\ncalling(2,5);\n*/' Comment.Multiline
284 '\n' Text.Whitespace
285
286 'int' Keyword.Type
287 ' ' Text.Whitespace
288 'func6' Name.Function
289 '(' Punctuation
290 'int' Keyword.Type
291 ' ' Text.Whitespace
292 'x' Name
293 ',' Punctuation
294 ' ' Text.Whitespace
295 'int' Keyword.Type
296 ' ' Text.Whitespace
297 'y' Name
298 ')' Punctuation
299 '\n' Text.Whitespace
300
301 ' ' Text.Whitespace
302 '//@requires y >= 0\n' Comment.Single
303
304 ' ' Text.Whitespace
305 '//@requires y >= 0;\n' Comment.Single
306
307 ' ' Text.Whitespace
308 '/*\n hello(2,3);\n */' Comment.Multiline
309 '\n' Text.Whitespace
310
311 ' ' Text.Whitespace
312 '/*\n hello(2,3)\n */' Comment.Multiline
313 '\n' Text.Whitespace
314
315 ' ' Text.Whitespace
316 '{' Punctuation
317 '\n' Text.Whitespace
318
319 ' ' Text.Whitespace
320 '// haha(2,3);\n' Comment.Single
321
322 ' ' Text.Whitespace
323 'return' Keyword
324 ' ' Text.Whitespace
325 'x' Name
326 ' ' Text.Whitespace
327 '/' Operator
328 ' ' Text.Whitespace
329 'y' Name
330 ';' Punctuation
331 '\n' Text.Whitespace
332
333 ' ' Text.Whitespace
334 '/*\n callblabla(x, y);\n */' Comment.Multiline
335 '\n' Text.Whitespace
336
337 ' ' Text.Whitespace
338 '}' Punctuation
339 '\n' Text.Whitespace
340
341 '//@requires y >= 0;\n' Comment.Single
342
343 '//@requires y >= 0\n' Comment.Single
344
345 '/*\ncalling(2,5)\n*/' Comment.Multiline
346 '\n' Text.Whitespace
347
348 '/*\ncalling(2,5);\n*/' Comment.Multiline
349 '\n' Text.Whitespace
350
351 '\n' Text.Whitespace
352
353 '\n' Text.Whitespace
354
355 'int' Keyword.Type
356 ' ' Text.Whitespace
357 '*' Operator
358 ' ' Text.Whitespace
359 '//@# a pointer to int\n' Comment.Single
360
361 'func7' Name.Function
362 ' ' Text.Whitespace
363 '/* @# why a comment here? */' Comment.Multiline
364 ' ' Text.Whitespace
365 '(' Punctuation
366 '\n' Text.Whitespace
367
368 ' ' Text.Whitespace
369 'int' Keyword.Type
370 ' ' Text.Whitespace
371 '/* the index has to be an int */' Comment.Multiline
372 ' ' Text.Whitespace
373 'a' Name
374 ',' Punctuation
375 ' ' Text.Whitespace
376 '// index into the array\n' Comment.Single
377
378 ' ' Text.Whitespace
379 'int' Keyword.Type
380 ' ' Text.Whitespace
381 '*' Operator
382 'b' Name
383 ' ' Text.Whitespace
384 '//the array @!\n' Comment.Single
385
386 ')' Punctuation
387 '\n' Text.Whitespace
388
389 '/*\n The end of the func params @ (@ will result error if parsed incorrectly)\n*/' Comment.Multiline
390 '\n' Text.Whitespace
391
392 '{' Punctuation
393 '\n' Text.Whitespace
394
395 ' ' Text.Whitespace
396 '// yet another comment\n' Comment.Single
397
398 ' ' Text.Whitespace
399 'return' Keyword
400 ' ' Text.Whitespace
401 'b' Name
402 '[' Punctuation
403 'a' Name
404 ']' Punctuation
405 ';' Punctuation
406 '\n' Text.Whitespace
407
408 '}' Punctuation
409 '\n' Text.Whitespace