fix weird legacy acorn formatting

This commit is contained in:
Sebastian McKenzie 2015-08-24 15:31:41 -04:00
parent 032ca7ae1c
commit 6e24626482

View File

@ -27,9 +27,12 @@ export class Token {
function codePointToString(code) {
// 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);
}
}
export default class Tokenizer {
constructor(options, input) {
@ -138,11 +141,12 @@ export default class Tokenizer {
readToken(code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, true) || code === 92 /* '\' */)
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
return this.readWord();
} else {
return this.getTokenFromCode(code);
}
}
fullCharCodeAtPos() {
let code = this.input.charCodeAt(this.state.pos);
@ -166,6 +170,7 @@ export default class Tokenizer {
this.state.tokens.push(comment);
this.state.comments.push(comment);
}
this.addComment(comment);
}