state.js 595 B

1234567891011121314151617
  1. import {tokenizer, SourceLocation, tokTypes as tt} from ".."
  2. export function LooseParser(input, options) {
  3. this.toks = tokenizer(input, options)
  4. this.options = this.toks.options
  5. this.input = this.toks.input
  6. this.tok = this.last = {type: tt.eof, start: 0, end: 0}
  7. if (this.options.locations) {
  8. let here = this.toks.curPosition()
  9. this.tok.loc = new SourceLocation(this.toks, here, here)
  10. }
  11. this.ahead = []; // Tokens ahead
  12. this.context = []; // Indentation contexted
  13. this.curIndent = 0
  14. this.curLineStart = 0
  15. this.nextLineStart = this.lineEnd(this.curLineStart) + 1
  16. }