Skip to content

Commit

Permalink
fix operand type mismatch error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolSpy3 committed Aug 28, 2024
1 parent 2b8f2e5 commit ed991e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/src/helperfunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ export function populateRegisters(completionList: CompletionList) {
kind: CompletionItemKind.Variable
});
}

/**
* Preprocesses a line of HMMM code by removing comments and trimming trailing whitespace
* @param document The document to read the line from
* @param line The line number to preprocess
* @returns The preprocessed line
*/

export function preprocessDocumentLine(document: TextDocument, line: number) {
return preprocessLine(document.getText(getRangeForLine(line)));
}
Expand Down
6 changes: 3 additions & 3 deletions server/src/hmmmserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
diagnostics.push({ // The instruction expects a register, but the operand is not a register
severity: DiagnosticSeverity.Error,
range: Range.create(lineIdx, indices[operandIdx][0], lineIdx, indices[operandIdx][1]),
message: `${instruction.name} expects a register as operand 1`,
message: `${instruction.name} expects a register here`,
source: 'HMMM Language Server',
data: 'invalid_operand_type'
});
Expand All @@ -316,7 +316,7 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
diagnostics.push({ // The instruction expects a signed number, but the operand is not a signed number
severity: DiagnosticSeverity.Error,
range: Range.create(lineIdx, indices[operandIdx][0], lineIdx, indices[operandIdx][1]),
message: `${instruction.name} expects a signed number (-128 to 127) as operand 1`,
message: `${instruction.name} expects a signed number (-128 to 127) here`,
source: 'HMMM Language Server',
data: 'invalid_operand_type'
});
Expand All @@ -327,7 +327,7 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
diagnostics.push({ // The instruction expects an unsigned number, but the operand is not an unsigned number
severity: DiagnosticSeverity.Error,
range: Range.create(lineIdx, indices[operandIdx][0], lineIdx, indices[operandIdx][1]),
message: `${instruction.name} expects a signed number (-128 to 127) as operand 1`,
message: `${instruction.name} expects an unsigned number (0 to 255) here`,
source: 'HMMM Language Server',
data: 'invalid_operand_type'
});
Expand Down

0 comments on commit ed991e5

Please sign in to comment.