Skip to content

Main content

INI Line Kind Tokenizer

Tokenize restricted INI physical lines into blank/comment/section/trimmed equals assignments; no multiline, escaping, interpolation, inline comments or inheritance.

Loading tool…

Description

Tokenize restricted INI physical lines into blank/comment/section/trimmed equals assignments; no multiline, escaping, interpolation, inline comments or inheritance.

INI-like configuration formats vary between applications. In this tool family, assignments are explicit section/name/value records and the empty section string means global scope. Duplicate-key policies, case handling and preservation of comments are separate choices rather than one universal INI behavior.

Tokenize restricted INI physical lines into blank/comment/section/trimmed equals assignments; no multiline, escaping, interpolation, inline comments or inheritance.

When to use this tool

Use this tool to tokenize restricted INI physical lines into blank/comment/section/trimmed equals assignments; no multiline, escaping, interpolation, inline comments or inheritance.

How to use the tool and how it works

  1. Enter text using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.lines. Use the ordering, boundary rules and absence conditions described below.

Split CRLF or LF lines, trim for classification, then identify blank, comment, bracketed section or first-equals assignment records.1

Input fieldMeaning and unitsAccepted input
textINI-dialect text with CRLF or LF line boundaries.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
Output fieldInterpretation
resultObject containing the named fields below.
result.linesInput-order line classifications with zero-based line indexes.
json
{
  "input": {
    "text": "[a]\nx=1\n#c"
  },
  "output": {
    "result": {
      "lines": [
        {
          "index": 0,
          "kind": "section",
          "section": "a"
        },
        {
          "index": 1,
          "kind": "assignment",
          "name": "x",
          "value": "1"
        },
        {
          "index": 2,
          "kind": "comment"
        }
      ]
    }
  }
}

Limitations and assumptions

  • Quoted values, interpolation and inline-comment semantics are not a general INI language here; final LF creates a final blank line.
  • Assignment records contain section, name and value strings. Nonempty section/key names cannot have surrounding whitespace, brackets or CR/LF/NUL. Values cannot contain CR/LF/NUL; a key cannot contain equals. No implicit interpolation or typed-value conversion is performed.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Select the consuming application’s dialect and duplicate-key policy explicitly. Use a lossless configuration editor when comments, original spacing, quoting or application-specific interpolation must be preserved.

References

  1. Tool behavior and example: INI Line Kind Tokenizer — tool.io

Similar or alternative tools

  • INI Comment Line Classifier

    Classify whole-line comments in a restricted INI dialect using first non-SP/HTAB semicolon or hash; not inline comment stripping or quote handling.

  • INI Section Name Line Formatter

    Format a literal nonempty trimmed INI section name for the restricted bracketed dialect; no escaping, nesting or case normalization.