Parser regression in 0.7.0
Closed this issue · 2 comments
marcalff commented
The following yaml parses fine with 0.6.0:
file_format: 0.0
tracer_provider:
processors:
- simple:
exporter:
console:
sampler:
trace_id_ratio_based:
ratio:
With 0.7.0, I get a parse error on sampler:
:
8:3: (102B): ERROR: parse error
8:3: sampler: (size=10)
^~~~~~~~ (cols 3-11)
marcalff commented
Investigated a bit, turning ryml debug and looking at the parser debug trace.
Some observations.
- stdout and stderr can be mixed
When capturing stdout and stderr to the same file, messages can mixed, as seen here:
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1757: searching for state with indentation 2. current: ind=8,level=5,node=6,flags=RMAP|BLCK|RNXT
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1757: searching for state with indentation 2. current: ind=6,level=4,node=5,flags=RMAP|BLCK|RNXT
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1757: searching for state with indentation 2. current: ind=4,level=3,node=4,flags=RSEQ|BLCK|RNXT
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1757: searching for 8:3: (102B): ERROR:
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:6752: parse error
8:3: sampler: (size=10)
^~~~~~~~ (cols 3-11)
top state: RMAP|BLCK|RNXT
state with indentation 2. current: ind=2,level=2,node=3,flags=RMAP|BLCK|RNXT
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1764: same indentation!!! level=2 node=3
Please consider to flush stdout before writing to stderr, when raising a parse error.
- parse error location
The error is raised at src/c4/yml/parse_engine.def.hpp:6752
(all line numbers using label v0.7.0).
From what I can tell, when seeing sampler:
:
- the previous nodes are poped, closing maps and sequences
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/event_handler_tree.hpp:298: node[3]: end_seq_val
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1699: current level is 2 (indentation=2)
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:6323: mapblck[RVAL]: still mapblck!
- the code loops to find a mapblock
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:1420: line[8] (11 cols) progressed by 2: col 1-->3 offset 100-->102
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:7044: mapblck: again
- and then it chokes on finding
sampler
, not knowing what to do with a token which is neither a:
nor a space.
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:5943: handle2_map_block: map_id=2 node_id=3 level=2 indref=2
/data/malff/CODE/MY_GITHUB/rapidyaml/src/c4/yml/parse_engine.def.hpp:6727: mapblck[RNXT]: 's'