Upstream spencermountain/compromise state of the touched files before 0866b22381

This commit is contained in:
upstream committed 2026-10-14 19:27:14 +02:00
1 parent aa0091324b
commit e86878b0f3
2 files changed
+70 -12

No files matched your search

@@ -31,7 +31,7 @@ const stripBoth = function (str) {
return str
}
//
const parseToken = function (w, opts, aliases) {
const parseToken = function (w, opts) {
const obj = {}
//collect any flags (do it twice)
for (let i = 0; i < 2; i += 1) {
@@ -73,7 +73,7 @@ const parseToken = function (w, opts, aliases) {
}
}
//back-flags
if (end(w) === '+' && !w.endsWith('\\+')) {
if (end(w) === '+') {
obj.greedy = true
w = stripEnd(w)
}
@@ -98,7 +98,7 @@ const parseToken = function (w, opts, aliases) {
}
//regex
if (start(w) === '/' && end(w) === '/' && w.length > 2) {
if (start(w) === '/' && end(w) === '/') {
w = stripBoth(w)
if (opts.caseSensitive) {
obj.use = 'text'
@@ -156,7 +156,7 @@ const parseToken = function (w, opts, aliases) {
obj.choices = obj.choices.filter(s => s)
//recursion alert!
obj.choices = obj.choices.map(str => {
return str.split(/ /g).map(s => parseToken(s, opts, aliases))
return str.split(/ /g).map(s => parseToken(s, opts))
})
w = ''
}
@@ -197,12 +197,8 @@ const parseToken = function (w, opts, aliases) {
}
//do the actual token content
if (start(w) === '#') {
const name = stripStart(w)
obj.tag = aliases?.[name]
if (!obj.tag) {
obj.tag = titleCase(name)
obj.tag = aliases?.[obj.tag] || obj.tag
}
obj.tag = stripStart(w)
obj.tag = titleCase(obj.tag)
return obj
}
//dynamic function on a term object
@@ -225,8 +221,6 @@ const parseToken = function (w, opts, aliases) {
//somehow handle encoded-chars?
w = w.replace('\\*', '*')
w = w.replace('\\.', '.')
w = w.replace('\\+', '+')
w = w.replace('\\/', '/')
if (opts.caseSensitive) {
obj.use = 'text'
} else {