fix weird legacy acorn formatting
This commit is contained in:
parent
032ca7ae1c
commit
6e24626482
@ -27,8 +27,11 @@ export class Token {
|
|||||||
|
|
||||||
function codePointToString(code) {
|
function codePointToString(code) {
|
||||||
// UTF-16 Decoding
|
// UTF-16 Decoding
|
||||||
if (code <= 0xFFFF) return String.fromCharCode(code);
|
if (code <= 0xFFFF) {
|
||||||
|
return String.fromCharCode(code);
|
||||||
|
} else {
|
||||||
return String.fromCharCode(((code - 0x10000) >> 10) + 0xD800, ((code - 0x10000) & 1023) + 0xDC00);
|
return String.fromCharCode(((code - 0x10000) >> 10) + 0xD800, ((code - 0x10000) & 1023) + 0xDC00);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Tokenizer {
|
export default class Tokenizer {
|
||||||
@ -138,11 +141,12 @@ export default class Tokenizer {
|
|||||||
readToken(code) {
|
readToken(code) {
|
||||||
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
||||||
// identifiers, so '\' also dispatches to that.
|
// identifiers, so '\' also dispatches to that.
|
||||||
if (isIdentifierStart(code, true) || code === 92 /* '\' */)
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
||||||
return this.readWord();
|
return this.readWord();
|
||||||
|
} else {
|
||||||
return this.getTokenFromCode(code);
|
return this.getTokenFromCode(code);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fullCharCodeAtPos() {
|
fullCharCodeAtPos() {
|
||||||
let code = this.input.charCodeAt(this.state.pos);
|
let code = this.input.charCodeAt(this.state.pos);
|
||||||
@ -166,6 +170,7 @@ export default class Tokenizer {
|
|||||||
this.state.tokens.push(comment);
|
this.state.tokens.push(comment);
|
||||||
this.state.comments.push(comment);
|
this.state.comments.push(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addComment(comment);
|
this.addComment(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user