90b6b1f0798ed36dea6b865fccf143f41e647c8b
[yaffs-website] / vendor / nikic / php-parser / test / code / parser / comments.test
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: Stmt_Expression(
25         expr: Expr_Variable(
26             name: var
27             comments: array(
28                 0: /** doc 1 */
29                 1: /* foobar 1 */
30                 2: // foo 1
31                 3: // bar 1
32             )
33         )
34         comments: array(
35             0: /** doc 1 */
36             1: /* foobar 1 */
37             2: // foo 1
38             3: // bar 1
39         )
40     )
41     1: Stmt_If(
42         cond: Expr_Variable(
43             name: cond
44         )
45         stmts: array(
46             0: Stmt_Nop(
47                 comments: array(
48                     0: /** doc 2 */
49                     1: /* foobar 2 */
50                     2: // foo 2
51                     3: // bar 2
52                 )
53             )
54         )
55         elseifs: array(
56         )
57         else: null
58     )
59     2: Stmt_Nop(
60         comments: array(
61             0: /** doc 3 */
62             1: /* foobar 3 */
63             2: // foo 3
64             3: // bar 3
65         )
66     )
67 )
68 -----
69 <?php
70
71 /** doc */
72 /* foobar */
73 // foo
74 // bar
75
76 ?>
77 -----
78 array(
79     0: Stmt_Nop(
80         comments: array(
81             0: /** doc */
82             1: /* foobar */
83             2: // foo
84             3: // bar
85         )
86     )
87 )
88 -----
89 <?php
90
91 // comment
92 if (42) {}
93 -----
94 array(
95     0: Stmt_If(
96         cond: Scalar_LNumber(
97             value: 42
98         )
99         stmts: array(
100         )
101         elseifs: array(
102         )
103         else: null
104         comments: array(
105             0: // comment
106         )
107     )
108 )