1--TEST--
2Semi reserved words support: class const
3--SKIPIF--
4<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
5--FILE--
6<?php
7$tokens = token_get_all('<?php
8  class SomeClass {
9      const CONST = 1;
10      const CONTINUE = (self::CONST + 1);
11      const ARRAY = [1, self::CONTINUE => [3, 4], 5];
12  }
13', TOKEN_PARSE);
14
15array_walk($tokens, function($tk) {
16  if(is_array($tk)) {
17    if(($t = token_name($tk[0])) == 'T_WHITESPACE') return;
18    echo "L{$tk[2]}: ".$t." {$tk[1]}", PHP_EOL;
19  }
20  else echo $tk, PHP_EOL;
21});
22
23echo "Done";
24
25?>
26--EXPECTF--
27L1: T_OPEN_TAG <?php
28
29L2: T_CLASS class
30L2: T_STRING SomeClass
31{
32L3: T_CONST const
33L3: T_STRING CONST
34=
35L3: T_LNUMBER 1
36;
37L4: T_CONST const
38L4: T_STRING CONTINUE
39=
40(
41L4: T_STRING self
42L4: T_DOUBLE_COLON ::
43L4: T_STRING CONST
44+
45L4: T_LNUMBER 1
46)
47;
48L5: T_CONST const
49L5: T_STRING ARRAY
50=
51[
52L5: T_LNUMBER 1
53,
54L5: T_STRING self
55L5: T_DOUBLE_COLON ::
56L5: T_STRING CONTINUE
57L5: T_DOUBLE_ARROW =>
58[
59L5: T_LNUMBER 3
60,
61L5: T_LNUMBER 4
62]
63,
64L5: T_LNUMBER 5
65]
66;
67}
68Done
69