in src/scanner.ts [723:759]
private scanOctalLiteral(prefix: string, start: number): RawToken {
let num = '';
let octal = false;
if (Character.isOctalDigit(prefix.charCodeAt(0))) {
octal = true;
num = '0' + this.source[this.index++];
} else {
++this.index;
}
while (!this.eof()) {
if (!Character.isOctalDigit(this.source.charCodeAt(this.index))) {
break;
}
num += this.source[this.index++];
}
if (!octal && num.length === 0) {
// only 0o or 0O
this.throwUnexpectedToken();
}
if (Character.isIdentifierStart(this.source.charCodeAt(this.index)) || Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
this.throwUnexpectedToken();
}
return {
type: Token.NumericLiteral,
value: parseInt(num, 8),
octal: octal,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
}