Fix some bugs in textual input/ouput
This commit is contained in:
parent
49a83f9a77
commit
17bdb2d7cb
3 changed files with 5 additions and 7 deletions
|
@ -39,9 +39,8 @@ export class TextPosition {
|
|||
} else {
|
||||
this.column++;
|
||||
}
|
||||
this.offset += text.length;
|
||||
}
|
||||
|
||||
this.offset += text.length;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -617,7 +616,7 @@ export class StringLiteral extends TokenBase {
|
|||
} else if (code <= 127) {
|
||||
out += '\\x' + code.toString(16).padStart(2, '0');
|
||||
} else {
|
||||
out += '\\u' + code.toString(17).padStart(4, '0');
|
||||
out += '\\u' + code.toString(16).padStart(4, '0');
|
||||
}
|
||||
}
|
||||
out += '"';
|
||||
|
|
|
@ -331,14 +331,14 @@ export class ConsoleDiagnostics implements Diagnostics {
|
|||
if (leftNode !== null) {
|
||||
this.writer.indent();
|
||||
this.writer.write(ANSI_FG_YELLOW + ANSI_BOLD + `info: ` + ANSI_RESET);
|
||||
this.writer.write(`type ` + ANSI_FG_GREEN + describeType(diagnostic.left) + ANSI_RESET + ` was inferred from diagnostic expression:\n\n`);
|
||||
this.writer.write(`type ` + ANSI_FG_GREEN + describeType(diagnostic.left) + ANSI_RESET + ` was inferred from this expression:\n\n`);
|
||||
this.writer.write(printNode(leftNode) + '\n');
|
||||
this.writer.dedent();
|
||||
}
|
||||
if (rightNode !== null) {
|
||||
this.writer.indent();
|
||||
this.writer.write(ANSI_FG_YELLOW + ANSI_BOLD + `info: ` + ANSI_RESET);
|
||||
this.writer.write(`type ` + ANSI_FG_GREEN + describeType(diagnostic.right) + ANSI_RESET + ` was inferred from diagnostic expression:\n\n`);
|
||||
this.writer.write(`type ` + ANSI_FG_GREEN + describeType(diagnostic.right) + ANSI_RESET + ` was inferred from this expression:\n\n`);
|
||||
this.writer.write(printNode(rightNode) + '\n');
|
||||
this.writer.dedent();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import {
|
|||
InstanceKeyword,
|
||||
Backslash,
|
||||
} from "./cst"
|
||||
import { Diagnostics, UnexpectedCharDiagnostic } from "./diagnostics"
|
||||
import { Diagnostics } from "./diagnostics"
|
||||
import { Stream, BufferedStream, assert } from "./util";
|
||||
|
||||
const EOF = '\uFFFF'
|
||||
|
@ -182,7 +182,6 @@ export class Scanner extends BufferedStream<Token> {
|
|||
|
||||
case '"':
|
||||
{
|
||||
const startPos = this.getCurrentPosition();
|
||||
let contents = '';
|
||||
let escaping = false;
|
||||
for (;;) {
|
||||
|
|
Loading…
Reference in a new issue