Skip to content

Commit

Permalink
add nextTokenStartSince method
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 4, 2020
1 parent 8a98ec9 commit 84f6abc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/babel-parser/src/tokenizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,14 @@ export default class Tokenizer extends ParserErrors {
}

nextTokenStart(): number {
const thisTokEnd = this.state.pos;
skipWhiteSpace.lastIndex = thisTokEnd;
return this.nextTokenStartSince(this.state.pos);
}

nextTokenStartSince(pos: number): number {
skipWhiteSpace.lastIndex = pos;
const skip = skipWhiteSpace.exec(this.input);
// $FlowIgnore: The skipWhiteSpace ensures to match any string
return thisTokEnd + skip[0].length;
return pos + skip[0].length;
}

lookaheadCharCode(): number {
Expand Down

0 comments on commit 84f6abc

Please sign in to comment.