readToken()

in packages/path/src/tokenizer.ts [275:330]


  readToken(code: number, prevCode: number) {
    if (prevCode === 92) {
      return this.readKeyWord()
    }
    if (this.input.length <= this.state.pos) {
      this.finishToken(eofTok)
    } else if (this.curContext() === bracketDContext) {
      this.readIgnoreString()
    } else if (code === 123) {
      this.state.pos++
      this.finishToken(braceLTok)
    } else if (code === 125) {
      this.state.pos++
      this.finishToken(braceRTok)
    } else if (code === 42) {
      this.state.pos++
      if (this.getCode() === 42) {
        this.state.pos++
        return this.finishToken(dbStarTok)
      }
      this.finishToken(starTok)
    } else if (code === 33) {
      this.state.pos++
      this.finishToken(bangTok)
    } else if (code === 46) {
      this.state.pos++
      this.finishToken(dotTok)
    } else if (code === 91) {
      this.state.pos++
      if (this.getCode() === 91) {
        this.state.pos++
        return this.finishToken(bracketDLTok)
      }
      this.finishToken(bracketLTok)
    } else if (code === 126) {
      this.state.pos++
      this.finishToken(expandTok)
    } else if (code === 93) {
      this.state.pos++
      this.finishToken(bracketRTok)
    } else if (code === 40) {
      this.state.pos++
      this.finishToken(parenLTok)
    } else if (code === 41) {
      this.state.pos++
      this.finishToken(parenRTok)
    } else if (code === 44) {
      this.state.pos++
      this.finishToken(commaTok)
    } else if (code === 58) {
      this.state.pos++
      this.finishToken(colonTok)
    } else {
      this.readKeyWord()
    }
  }