Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tokenizeLine (inputLine, ruleStack, firstLine = false, compatibilityMode = true) {
let line, openScopeTags
const tags = []
let truncatedLine = false
if (inputLine.length > this.maxLineLength) {
line = inputLine.slice(0, this.maxLineLength)
truncatedLine = true
} else {
line = inputLine
}
const string = new OnigString(`${line}\n`)
if (ruleStack) {
ruleStack = ruleStack.slice()
if (compatibilityMode) {
openScopeTags = []
for (let {scopeName, contentScopeName} of ruleStack) {
if (scopeName) { openScopeTags.push(this.registry.startIdForScope(scopeName)) }
if (contentScopeName) { openScopeTags.push(this.registry.startIdForScope(contentScopeName)) }
}
}
} else {
if (compatibilityMode) { openScopeTags = [] }
const initialRule = this.getInitialRule()
let {scopeName, contentScopeName} = initialRule
ruleStack = [{rule: initialRule, scopeName, contentScopeName}]
if (scopeName) { tags.push(this.startIdForScope(initialRule.scopeName)) }