Skip to content

Commit 87968c3

Browse files
author
H. Peter Anvin (Intel)
committed
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>
1 parent 620dd31 commit 87968c3

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

editors/nasmtok.pl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,24 @@ sub write_output_json {
367367
$ver{$vn} = $vv;
368368
}
369369

370-
print $out $json->encode({
370+
my $txt = $json->encode({
371371
'$comment' => "NASM syntax information extracted from ${whoami}",
372372
'tokens' => \%tokens, 'version' => \%ver});
373-
print $out "\n";
373+
374+
# $json->encode() creates a single long line; break up the lines
375+
# at least...
376+
my @txt = split(/\,/, $txt);
377+
my $last = shift @txt;
378+
foreach my $t (@txt) {
379+
if (length($last)+length($t) > 77) {
380+
print $out $last, ",\n";
381+
$last = $t;
382+
} else {
383+
$last .= ",$t";
384+
}
385+
}
386+
print $out $last, "\n";
387+
374388
return 0;
375389
}
376390

0 commit comments

Comments
 (0)