Skip to content

Main content

Parsing: Yaml Block Chomp Indicator Tool

Parse a restricted YAML block-scalar style/indent/chomping indicator token in either allowed modifier order; does not parse indentation, content or a YAML document.

Loading tool…

Description

Parse a restricted YAML block-scalar style/indent/chomping indicator token in either allowed modifier order; does not parse indentation, content or a YAML document.

YAML uses context-sensitive indicators for scalar styles, indentation, tags, anchors, and document boundaries. A token may be meaningful only within the surrounding stream and indentation structure. Recognizing one header or marker is distinct from parsing a document or resolving its values.

Parse a restricted YAML block-scalar style/indent/chomping indicator token in either allowed modifier order; does not parse indentation, content or a YAML document.

When to use this tool

Use Parsing: Yaml Block Chomp Indicator when you need to recognize the supported YAML marker or header token before a broader parsing step.

How to use the tool and how it works

  1. Enter indicator. 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 result. Expand result to inspect the returned fields.

Accept | or > followed by an optional indentation digit 1-9 and optional chomping sign, in either permitted order. Return style, chomping, and explicitIndent as the digit or zero when absent inside result.1

A YAML block-scalar header distinguishes style, indentation, and chomping. Chomping governs final line breaks and trailing empty lines, while this tool only returns the indicator labels.2

Input fieldMeaning and unitsAccepted input
indicatorIndicatorRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultObject containing the calculated result members described below.Required. Object.
result.styleStyleCalculated result member: string.
result.chompingChompingCalculated result member: string.
result.explicitIndentDigit 1-9, or zero meaning no explicit indentation indicator.Calculated result member: number.
json
{
  "input": {
    "indicator": "|2-"
  },
  "output": {
    "result": {
      "style": "literal",
      "chomping": "strip",
      "explicitIndent": 2
    }
  }
}

Limitations and assumptions

  • ExplicitIndent=0 means unspecified rather than a zero-space indentation rule. Only the indicator token is parsed; scalar content, parent indentation, trailing comments, and complete YAML validity are separate.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a full YAML parser for stream context, indentation, aliases, tags, scalar content, and document validity. Treat the output as the stated local recognition result.

References

  1. Calculation and input contract: parse/yaml-block-chomp-indicator — tool.io

  2. YAML 1.2.2: Block Scalar Headers — YAML Language Development Team

Similar or alternative tools