Skip to content

Commit 0d9feca

Browse files
committed
x86spec: fix header parsing
The existing implementation of the Intel x86 doc parser matches headers by just trimming spaces. However, there are cases, when a header string takes several lines, which breaks current switch case matching, e.g. during the parsing of AMX operations. This commit fixes it by replacing \n with a whitespace in a header string. For: #61079
1 parent 060bf14 commit 0d9feca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x86/x86spec/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ func processListing(p *listing, insts *[]*instruction) {
791791
for i, hdr := range heading {
792792
x := row[i]
793793
x = strings.Replace(x, "\n", " ", -1)
794-
switch strings.TrimSpace(hdr) {
794+
switch strings.Replace(strings.TrimSpace(hdr), "\n", " ", -1) {
795795
default:
796796
wrong = "unexpected header: " + strconv.Quote(hdr)
797797
goto BadTable

0 commit comments

Comments
 (0)