Home / Function/ parseText() — vue Function Reference

parseText() — vue Function Reference

Architecture documentation for the parseText() function in text-parser.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  98ee1e5f_4546_f8dd_b03c_1579380b057f["parseText()"]
  fac2f34b_3866_3537_2607_6622b0e848eb["resolveTemplateUsageCheckString()"]
  fac2f34b_3866_3537_2607_6622b0e848eb -->|calls| 98ee1e5f_4546_f8dd_b03c_1579380b057f
  bbf88914_62b5_839d_3cfb_85a00fd1d67b["parse()"]
  bbf88914_62b5_839d_3cfb_85a00fd1d67b -->|calls| 98ee1e5f_4546_f8dd_b03c_1579380b057f
  a8b5582c_75a3_d739_c9b5_27e2ceb67bc3["processAttrs()"]
  a8b5582c_75a3_d739_c9b5_27e2ceb67bc3 -->|calls| 98ee1e5f_4546_f8dd_b03c_1579380b057f
  b99b1c17_88bd_b28b_f216_7b2ce17de916["transformNode()"]
  b99b1c17_88bd_b28b_f216_7b2ce17de916 -->|calls| 98ee1e5f_4546_f8dd_b03c_1579380b057f
  6758f672_6a56_f76d_7ea5_63af7382caff["transformNode()"]
  6758f672_6a56_f76d_7ea5_63af7382caff -->|calls| 98ee1e5f_4546_f8dd_b03c_1579380b057f
  463921b4_0e8b_8e70_7164_e4a31b8fe393["buildRegex()"]
  98ee1e5f_4546_f8dd_b03c_1579380b057f -->|calls| 463921b4_0e8b_8e70_7164_e4a31b8fe393
  864d3348_97c0_ef1e_0722_64a34582d8e6["parseFilters()"]
  98ee1e5f_4546_f8dd_b03c_1579380b057f -->|calls| 864d3348_97c0_ef1e_0722_64a34582d8e6
  style 98ee1e5f_4546_f8dd_b03c_1579380b057f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/parser/text-parser.ts lines 18–52

export function parseText(
  text: string,
  delimiters?: [string, string]
): TextParseResult | void {
  //@ts-expect-error
  const tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE
  if (!tagRE.test(text)) {
    return
  }
  const tokens: string[] = []
  const rawTokens: any[] = []
  let lastIndex = (tagRE.lastIndex = 0)
  let match, index, tokenValue
  while ((match = tagRE.exec(text))) {
    index = match.index
    // push text token
    if (index > lastIndex) {
      rawTokens.push((tokenValue = text.slice(lastIndex, index)))
      tokens.push(JSON.stringify(tokenValue))
    }
    // tag token
    const exp = parseFilters(match[1].trim())
    tokens.push(`_s(${exp})`)
    rawTokens.push({ '@binding': exp })
    lastIndex = index + match[0].length
  }
  if (lastIndex < text.length) {
    rawTokens.push((tokenValue = text.slice(lastIndex)))
    tokens.push(JSON.stringify(tokenValue))
  }
  return {
    expression: tokens.join('+'),
    tokens: rawTokens
  }
}

Domain

Subdomains

Frequently Asked Questions

What does parseText() do?
parseText() is a function in the vue codebase.
What does parseText() call?
parseText() calls 2 function(s): buildRegex, parseFilters.
What calls parseText()?
parseText() is called by 5 function(s): parse, processAttrs, resolveTemplateUsageCheckString, transformNode, transformNode.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free