mirror of
https://gitee.com/RubyMetric/chsrc.git
synced 2025-12-25 20:52:49 +00:00
Show config blocks when debugging Parser
This commit is contained in:
parent
ff14468b14
commit
2dbee0b272
|
|
@ -318,7 +318,18 @@ class Parser {
|
|||
my sub format-section($section, $level) {
|
||||
my $prefix = ' ' x $level;
|
||||
my $title = $section.title // '(Root)';
|
||||
return "{$prefix}- {$title} (level {$section.level})";
|
||||
my $base-info = "{$prefix}- {$title} (level {$section.level})";
|
||||
|
||||
my $config-info = "";
|
||||
if $section.configblock.keys {
|
||||
my @config-items;
|
||||
for $section.configblock.keys -> $key {
|
||||
my $value = $section.configblock.get($key);
|
||||
@config-items.push: "$key = {$value.raw-value}";
|
||||
}
|
||||
$config-info = "\n" ~ "{$prefix} [" ~ @config-items.join(", ") ~ "]";
|
||||
}
|
||||
return $base-info ~ $config-info;
|
||||
}
|
||||
|
||||
# 嵌套的递归打印函数
|
||||
|
|
|
|||
Loading…
Reference in New Issue