Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80555 views
1
import {tokenizer, SourceLocation, tokTypes as tt} from ".."
2
3
export function LooseParser(input, options) {
4
this.toks = tokenizer(input, options)
5
this.options = this.toks.options
6
this.input = this.toks.input
7
this.tok = this.last = {type: tt.eof, start: 0, end: 0}
8
if (this.options.locations) {
9
let here = this.toks.curPosition()
10
this.tok.loc = new SourceLocation(this.toks, here, here)
11
}
12
this.ahead = []; // Tokens ahead
13
this.context = []; // Indentation contexted
14
this.curIndent = 0
15
this.curLineStart = 0
16
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
17
}
18
19