The original parser for indentation were relying on having just one description for each "what". However, that's not the case: there are a number of ABI symbols that got defined multiple times. Improve the parser for it to better handle descriptions if entries are duplicated.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -147,17 +147,19 @@ sub parse_abi { · 146 unmodified lines | ||
| 147 | 147 | parse_error($file, $ln, "'What:' should come first:", $_); |
| 148 | 148 | next; |
| 149 | 149 | } |
| 150 | − if ($tag eq "description") { | |
| 151 | − # Preserve initial spaces for the first line | |
| 150 | + if ($new_tag eq "description") { | |
| 151 | + $sep =~ s,:, ,; | |
| 152 | 152 | $content = ' ' x length($new_tag) . $sep . $content; |
| 153 | − $content =~ s,^(\s*):,$1 ,; | |
| 154 | − if ($content =~ m/^(\s*)(.*)$/) { | |
| 153 | + while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} | |
| 154 | + if ($content =~ m/^(\s*)(\S.*)$/) { | |
| 155 | + # Preserve initial spaces for the first line | |
| 155 | 156 | $space = $1; |
| 156 | − $content = $2; | |
| 157 | + $content = "$2\n"; | |
| 158 | + $data{$what}->{$tag} .= $content; | |
| 159 | + } else { | |
| 160 | + undef($space); | |
| 157 | 161 | } |
| 158 | − while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} | |
| 159 | 162 | |
| 160 | − $data{$what}->{$tag} .= "$content\n" if ($content); | |
| 161 | 163 | } else { |
| 162 | 164 | $data{$what}->{$tag} = $content; |
| 163 | 165 | } |
| @@ -174,28 +176,22 @@ sub parse_abi { · 10 unmodified lines | ||
| 174 | 176 | if ($tag eq "description") { |
| 175 | 177 | my $content = $_; |
| 176 | 178 | while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} |
| 177 | − if (!$data{$what}->{description}) { | |
| 179 | + if (m/^\s*\n/) { | |
| 180 | + $data{$what}->{$tag} .= "\n"; | |
| 181 | + next; | |
| 182 | + } | |
| 183 | + | |
| 184 | + if (!defined($space)) { | |
| 178 | 185 | # Preserve initial spaces for the first line |
| 179 | − if ($content =~ m/^(\s*)(.*)$/) { | |
| 186 | + if ($content =~ m/^(\s*)(\S.*)$/) { | |
| 180 | 187 | $space = $1; |
| 181 | − $content = $2; | |
| 188 | + $content = "$2\n"; | |
| 182 | 189 | } |
| 183 | − | |
| 184 | − $data{$what}->{$tag} .= "$content\n" if ($content); | |
| 185 | 190 | } else { |
| 186 | − if (m/^\s*\n/) { | |
| 187 | − $data{$what}->{$tag} .= $content; | |
| 188 | − next; | |
| 189 | − } | |
| 190 | − | |
| 191 | 191 | $space = "" if (!($content =~ s/^($space)//)); |
| 192 | − | |
| 193 | −# # Compress spaces with tabs | |
| 194 | −# $content =~ s<^ {8}> <\t>; | |
| 195 | −# $content =~ s<^ {1,7}\t> <\t>; | |
| 196 | −# $content =~ s< {1,7}\t> <\t>; | |
| 197 | − $data{$what}->{$tag} .= $content; | |
| 198 | 192 | } |
| 193 | + $data{$what}->{$tag} .= $content; | |
| 194 | + | |
| 199 | 195 | next; |
| 200 | 196 | } |
| 201 | 197 | if (m/^\s*(.*)/) { |