Skip to content

Commit bd20ad2

Browse files
committed
Added comment generation.
1 parent eea5240 commit bd20ad2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: tools/generator.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
$const = array();
55

66
while ($row = fgets(STDIN)) {
7-
if (preg_match('/^([0-9A-Z]{5}) +[SWE] +[^ ]+? +([a-z_]+)$/', $row, $matches)) {
7+
if (preg_match('/^Section: (Class .*)$/', $row, $matches)) {
8+
$const[] = '';
9+
$const[] = " // {$matches[1]}";
10+
} elseif (preg_match('/^([0-9A-Z]{5}) +[SWE] +[^ ]+? +([a-z_]+)$/', $row, $matches)) {
811
$key = strtoupper($matches[2]);
912
if (isset($codes[$key])) {
1013
$key .= '_EXCEPTION';
@@ -14,7 +17,7 @@
1417
}
1518
}
1619

17-
$const = implode(PHP_EOL, $const);
20+
$const = trim(implode(PHP_EOL, $const), PHP_EOL);
1821

1922
echo <<<EOD
2023
<?php

0 commit comments

Comments
 (0)