General.Web/wwwroot/lib/codemirror-5.31.0/src/util/StringStream.js
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
import { countColumn } from "./misc"
// STRING STREAM
// Fed to the mode parsers, provides helper functions to make
// parsers more succinct.
class StringStream {
constructor(string, tabSize, lineOracle) {
this.pos = this.start = 0
this.string = string
this.tabSize = tabSize || 8
this.lastColumnPos = this.lastColumnValue = 0
this.lineStart = 0
this.lineOracle = lineOracle
}
eol() {return this.pos >= this.string.length}
sol() {return this.pos == this.lineStart}
peek() {return this.string.charAt(this.pos) || undefined}
next() {
if (this.pos < this.string.length)
return this.string.charAt(this.pos++)
}
eat(match) {
let ch = this.string.charAt(this.pos)
let ok
if (typeof match == "string") ok = ch == match
else ok = ch && (match.test ? match.test(ch) : match(ch))
if (ok) {++this.pos; return ch}
}
eatWhile(match) {
let start = this.pos
while (this.eat(match)){}
return this.pos > start
}
eatSpace() {
let start = this.pos
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos
return this.pos > start
}
skipToEnd() {this.pos = this.string.length}
skipTo(ch) {
let found = this.string.indexOf(ch, this.pos)
if (found > -1) {this.pos = found; return true}
}
backUp(n) {this.pos -= n}
column() {
if (this.lastColumnPos < this.start) {
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
this.lastColumnPos = this.start
}
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
}
indentation() {
return countColumn(this.string, null, this.tabSize) -
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
}
match(pattern, consume, caseInsensitive) {
if (typeof pattern == "string") {
后面还有 30 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
