aboutsummaryrefslogtreecommitdiffstats
path: root/Bin
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-07 09:24:44 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-07 09:24:44 +0100
commit1f193a97ab35f483f4fe739ddeb7e82389a54607 (patch)
tree88a8615ada8edc2d4fbd26fc4184cf0c83b8e1c4 /Bin
parent280fc8e0088ae8345d4294951c878ce7261fc1ec (diff)
downloadCompiler-1f193a97ab35f483f4fe739ddeb7e82389a54607.zip
Compiler-1f193a97ab35f483f4fe739ddeb7e82389a54607.tar.gz
Compiler-1f193a97ab35f483f4fe739ddeb7e82389a54607.tar.bz2
Align Unicode token value when printing sequence.
Diffstat (limited to 'Bin')
-rw-r--r--Bin/Pp.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/Bin/Pp.php b/Bin/Pp.php
index 4eeed59..7087945 100644
--- a/Bin/Pp.php
+++ b/Bin/Pp.php
@@ -221,14 +221,14 @@ class Pp extends \Hoa\Console\Dispatcher\Kit {
$sequence = $compiler->getTokenSequence();
$format = '%' . (strlen((string) count($sequence)) + 1) . 's ' .
- '%-13s %-20s %-30s %6s' . "\n";
+ '%-13s %-20s %s %6s' . "\n";
$header = sprintf(
$format,
'#',
'namespace',
'token name',
- 'token value',
+ 'token value ',
'offset'
);
@@ -240,9 +240,12 @@ class Pp extends \Hoa\Console\Dispatcher\Kit {
$i,
$token['namespace'],
$token['token'],
- 35 < strlen($token['value'])
- ? substr($token['value'], 0, 34) . '…'
- : $token['value'],
+ 30 < $token['length']
+ ? mb_substr($token['value'], 0, 29) . '…'
+ : 'EOF' === $token['token']
+ ? str_repeat(' ', 30)
+ : $token['value'] .
+ str_repeat(' ', 30 - $token['length']),
$token['offset']
);