mirror of
https://github.com/netwide-assembler/nasm
synced 2026-08-26 16:23:04 -04:00
editors/nasmtok.pl: break nasmtok.json into lines
Instead of generating one single huge line of text, add newlines after suitable commas to make it at least a manageable text file. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
620dd315ee
commit
87968c3596
1 changed files with 16 additions and 2 deletions
|
|
@ -367,10 +367,24 @@ sub write_output_json {
|
|||
$ver{$vn} = $vv;
|
||||
}
|
||||
|
||||
print $out $json->encode({
|
||||
my $txt = $json->encode({
|
||||
'$comment' => "NASM syntax information extracted from ${whoami}",
|
||||
'tokens' => \%tokens, 'version' => \%ver});
|
||||
print $out "\n";
|
||||
|
||||
# $json->encode() creates a single long line; break up the lines
|
||||
# at least...
|
||||
my @txt = split(/\,/, $txt);
|
||||
my $last = shift @txt;
|
||||
foreach my $t (@txt) {
|
||||
if (length($last)+length($t) > 77) {
|
||||
print $out $last, ",\n";
|
||||
$last = $t;
|
||||
} else {
|
||||
$last .= ",$t";
|
||||
}
|
||||
}
|
||||
print $out $last, "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue