const stack:()

in js/src/android-parse.ts [139:178]


  const stack: (string | Expression)[] = []
  for (const part of pattern) {
    if (typeof part === 'string') {
      let pos = 0
      let quoted = stack.length > 0
      for (const m of part.matchAll(/(?<!\\)"/g)) {
        const prev = part.substring(pos, m.index)
        if (quoted) {
          if (stack.length) {
            yield* stack
            stack.length = 0
          }
          if (prev) yield prev
        } else if (prev) {
          yield prev.replace(/\s+/g, ' ')
        }
        pos = m.index + m[0].length
        quoted = !quoted
      }
      const last = part.substring(pos)
      if (quoted) stack.push(last)
      else if (last) yield last.replace(/\s+/g, ' ')
    } else if (stack.length) {
      if (
        isMarkup(part) ||
        (typeof part !== 'string' && part.attr?.translate === 'no')
      ) {
        yield '"'
        for (const part of stack) {
          yield typeof part === 'string' ? part.replace(/\s+/g, ' ') : part
        }
        stack.length = 0
        yield part
      } else {
        stack.push(part)
      }
    } else {
      yield part
    }
  }