diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-27 20:22:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-27 20:32:38 +0900 |
| commit | 4efa8ba0c0b749fa37b39393d3c29ac75314cc21 (patch) | |
| tree | 1448b2c556f506207145e41533872bd323795250 /tools/native-tokenizer.php | |
| parent | df39150ce837b0214366687d7c73d8ff36a315ce (diff) | |
| download | phphp-4efa8ba0c0b749fa37b39393d3c29ac75314cc21.tar.gz phphp-4efa8ba0c0b749fa37b39393d3c29ac75314cc21.tar.zst phphp-4efa8ba0c0b749fa37b39393d3c29ac75314cc21.zip | |
add files
Diffstat (limited to 'tools/native-tokenizer.php')
| -rwxr-xr-x | tools/native-tokenizer.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/native-tokenizer.php b/tools/native-tokenizer.php new file mode 100755 index 0000000..f153356 --- /dev/null +++ b/tools/native-tokenizer.php @@ -0,0 +1,11 @@ +#!/usr/bin/env php +<?php + +declare(strict_types=1); + +$source = file_get_contents('php://stdin'); +assert($source !== false); +$tokens = PhpToken::tokenize($source, TOKEN_PARSE); +foreach ($tokens as $token) { + echo "{$token->getTokenName()}: {$token->text}", PHP_EOL; +} |
