comparison vendor/nikic/php-parser/test/code/parser/comments.test @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 5fb285c0d0e3
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 Comments
2 -----
3 <?php
4
5 /** doc 1 */
6 /* foobar 1 */
7 // foo 1
8 // bar 1
9 $var;
10
11 if ($cond) {
12 /** doc 2 */
13 /* foobar 2 */
14 // foo 2
15 // bar 2
16 }
17
18 /** doc 3 */
19 /* foobar 3 */
20 // foo 3
21 // bar 3
22 -----
23 array(
24 0: Expr_Variable(
25 name: var
26 comments: array(
27 0: /** doc 1 */
28 1: /* foobar 1 */
29 2: // foo 1
30 3: // bar 1
31 )
32 )
33 1: Stmt_If(
34 cond: Expr_Variable(
35 name: cond
36 )
37 stmts: array(
38 0: Stmt_Nop(
39 comments: array(
40 0: /** doc 2 */
41 1: /* foobar 2 */
42 2: // foo 2
43 3: // bar 2
44 )
45 )
46 )
47 elseifs: array(
48 )
49 else: null
50 )
51 2: Stmt_Nop(
52 comments: array(
53 0: /** doc 3 */
54 1: /* foobar 3 */
55 2: // foo 3
56 3: // bar 3
57 )
58 )
59 )
60 -----
61 <?php
62
63 /** doc */
64 /* foobar */
65 // foo
66 // bar
67
68 ?>
69 -----
70 array(
71 0: Stmt_Nop(
72 comments: array(
73 0: /** doc */
74 1: /* foobar */
75 2: // foo
76 3: // bar
77 )
78 )
79 )
80 -----
81 <?php
82
83 // comment
84 if (42) {}
85 -----
86 array(
87 0: Stmt_If(
88 cond: Scalar_LNumber(
89 value: 42
90 )
91 stmts: array(
92 )
93 elseifs: array(
94 )
95 else: null
96 comments: array(
97 0: // comment
98 )
99 )
100 )