jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.92k stars 1.78k forks source link

Loading of block sequence with tag fails #1163

Open ncaklovic opened 1 year ago

ncaklovic commented 1 year ago

Loading of block sequence with tag (standard or application) and less than 3 spaces (at the line begin) fails with exception: "end of sequence not found". Such YAML is declared valid with number of online validators.

More details and examples

All following examples are successfully loaded

  1. not block sequence

    key: !t |
    multiple
    words
  2. no tag

    key: 
    - |
    multiple
    words
  3. more than 2 spaces (3)

    key: 
    - !!str |
    multiple
    words

but the following fail (1 or 2 spaces before "multiple" and "words"):

  1. application tag

    key: 
    - !t |
    multiple
    words
  2. standard tag

    key: 
    - !!str |
    multiple
    words

Possible solution

The change in Scanner::ScanTag:

seems to solve this problem, but breaks some of existing tests.