Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser regression in 0.7.0 #455

Closed
marcalff opened this issue Jul 29, 2024 · 2 comments · Fixed by #461
Closed

Parser regression in 0.7.0 #455

marcalff opened this issue Jul 29, 2024 · 2 comments · Fixed by #461

Comments

@marcalff
Copy link
Contributor

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
Copy link
Contributor Author

marcalff commented Aug 1, 2024

Investigated a bit, turning ryml debug and looking at the parser debug trace.

Some observations.

  1. 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.

  1. 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'

@marcalff
Copy link
Contributor Author

marcalff commented Aug 1, 2024

@biojppm

I hope this debugging helps.
Not sure how to get further into the code, as I don't know the parser states well enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant