Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9d6f0c
commit 8f862e7
Showing
3 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--TEST-- | ||
Test token_get_all() function with semi-reserved grammar | ||
--FILE-- | ||
<?php | ||
|
||
$tokens = token_get_all('<?php | ||
class { | ||
const CONST = "const"; | ||
public $public = "public"; | ||
protected function function(){} | ||
} | ||
const CONST = "const"; // syntax error | ||
function function(){} // syntax error | ||
'); | ||
|
||
// var_dump($tokens); | ||
|
||
echo token_name($tokens[5][0]), PHP_EOL; | ||
echo token_name($tokens[7][0]), PHP_EOL; | ||
echo PHP_EOL; | ||
echo token_name($tokens[14][0]), PHP_EOL; | ||
echo token_name($tokens[16][0]), PHP_EOL; | ||
echo PHP_EOL; | ||
echo token_name($tokens[25][0]), PHP_EOL; | ||
echo token_name($tokens[27][0]), PHP_EOL; | ||
echo PHP_EOL; | ||
echo token_name($tokens[35][0]), PHP_EOL; | ||
echo token_name($tokens[37][0]), PHP_EOL; | ||
echo PHP_EOL; | ||
echo token_name($tokens[46][0]), PHP_EOL; | ||
echo token_name($tokens[48][0]), PHP_EOL; | ||
|
||
echo "\nDone\n"; | ||
|
||
--EXPECT-- | ||
|
||
T_CONST | ||
T_STRING | ||
|
||
T_PUBLIC | ||
T_VARIABLE | ||
|
||
T_FUNCTION | ||
T_STRING | ||
|
||
T_CONST | ||
T_CONST | ||
|
||
T_FUNCTION | ||
T_FUNCTION | ||
|
||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters