aboutsummaryrefslogtreecommitdiffstats
path: root/Bin
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-08-21 09:44:03 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-08-21 09:44:03 +0200
commit393dafa2e27591ab691b1e02147515d33a3b807a (patch)
treeb5b50848f4fb28992e9a50cd1f97ee4e03922d58 /Bin
parent4aee51ce45904d71b15ebbf93967f636c1a09179 (diff)
downloadCompiler-393dafa2e27591ab691b1e02147515d33a3b807a.zip
Compiler-393dafa2e27591ab691b1e02147515d33a3b807a.tar.gz
Compiler-393dafa2e27591ab691b1e02147515d33a3b807a.tar.bz2
Show node ID when printing the trace.
Diffstat (limited to 'Bin')
-rw-r--r--Bin/Pp.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/Bin/Pp.php b/Bin/Pp.php
index 46cb6dd..dcd3e82 100644
--- a/Bin/Pp.php
+++ b/Bin/Pp.php
@@ -189,8 +189,18 @@ class Pp extends \Hoa\Console\Dispatcher\Kit {
$i = 0;
foreach($compiler->getTrace() as $element)
- if($element instanceof \Hoa\Compiler\Llk\Rule\Entry)
- echo str_repeat('> ', ++$i), 'enter ', $element->getRule(), "\n";
+ if($element instanceof \Hoa\Compiler\Llk\Rule\Entry) {
+
+ $ruleName = $element->getRule();
+ $rule = $compiler->getRule($ruleName);
+
+ echo str_repeat('> ', ++$i), 'enter ', $ruleName;
+
+ if(null !== $id = $rule->getNodeId())
+ echo ' (', $id, ')';
+
+ echo "\n";
+ }
elseif($element instanceof \Hoa\Compiler\Llk\Rule\Token)
echo str_repeat(' ', $i + 1), 'token ',$element->getTokenName(),
', consumed ', $element->getValue(), "\n";