Skip to content

Main content

Quotation Mark Nesting Role Tool

Apply explicit quote-token roles and a supplied symmetric-quote policy without guessing linguistic nesting.

Loading tool…

Description

Apply explicit quote-token roles and a supplied symmetric-quote policy without guessing linguistic nesting.

Text positions can be measured in UTF-16 code units, Unicode code points, grapheme clusters, or modeled display columns. These coordinates are not interchangeable. Invisible markers and delimiter policies can also affect interpretation even when a string looks unchanged, so the chosen representation needs to stay explicit.

Apply explicit quote-token roles and a supplied symmetric-quote policy without guessing linguistic nesting.

When to use this tool

Use Quotation Mark Nesting Role when you need the stated marker, coordinate, delimiter, or normalization operation under an explicit text representation.

How to use the tool and how it works

  1. Enter token, opening, closing, depth, symmetricRole. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read role, nextDepth. Use the output convention below.

Classify token against nonempty opening and closing labels, using symmetricRole when they coincide. Advance or reduce nonnegative integer depth accordingly, rejecting a close at depth zero.1

Input fieldMeaning and unitsAccepted input
tokenTokenRequired. Text; maximum UTF-16 length 8192.
openingOpeningRequired. Text; maximum UTF-16 length 8192.
closingClosingRequired. Text; maximum UTF-16 length 8192.
depthDepthRequired. Safe integer; minimum 0.
symmetricRoleSymmetric RoleRequired. Text; one of "open", "close"; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
roleRoleRequired. Text; maximum UTF-16 length 8192.
nextDepthNext DepthRequired. Safe integer.
json
{
  "input": {
    "token": "“",
    "opening": "“",
    "closing": "”",
    "depth": 0,
    "symmetricRole": "open"
  },
  "output": {
    "role": "open",
    "nextDepth": 1
  }
}

Limitations and assumptions

  • An unrecognized token keeps depth unchanged. The symmetric role is explicit rather than inferred from text, and this checks one transition without parsing a full quotation structure.
  • The field tables state structural bounds; the mechanics also specify cross-field constraints. Malformed inputs and unsupported domains cause errors. A successful false flag, empty branch value, or zero placeholder has the meaning stated above and is distinct from an input error.

Alternative or Complementary methods

Choose the coordinate system required by the consumer. Use a full parser, renderer, or segmentation method when a local marker or delimiter rule cannot determine the complete text behavior.

References

  1. Calculation and input contract: text/quotation-mark-nesting-role — tool.io

Similar or alternative tools

  • Text: Combining Mark Leading Position Flag

    Check whether the first scalar of a string has Unicode Mark general category using the runtime Unicode property table; not grapheme segmentation or a validity judgment.

  • Typographic Quote Nesting Pair

    Alternate curly double and single opening/closing quotes by nonnegative integer depth, with doubleOuter selecting which pair appears at even depth.