Skip to content

Commit

Permalink
Match registers after the instructions (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Jan 6, 2024
1 parent 6394470 commit b521cbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/WebApp/app/shared/codemirror/mode-asm.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test.each([
L0016: vmovdqa [rbp-0x20], xmm4
L001b: vmovdqa [rbp-0x10], xmm4`],
[ 'je', 'L000e: je short L0015' ],
[ 'fstp', 'L002e: fstp qword ptr [ebp-8], st' ],
[ 'jle', `L0015: jle short L0001` ]
] as const)('mode-asm codemirror highlights assembly instructions correctly', async (expectedToken: string, assemblyCode: string) => {

Expand Down
12 changes: 6 additions & 6 deletions source/WebApp/app/shared/codemirror/mode-asm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ CodeMirror.defineMode('asm', () => {
}
}

for (const index in registers) {
if (stream.match(registers[index], true, true)) {
return 'type';
}
}

for (const key in grammar) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (stream.match(grammar[key as keyof typeof grammar])) {
return key;
}
}

for (const index in registers) {
if (stream.match(registers[index], true, true)) {
return 'type';
}
}

stream.match(/\S+/);
return null;
}
Expand Down

0 comments on commit b521cbe

Please sign in to comment.