[llvm-dev] Using YAML I/O to read in a file produces "error: not a sequence" How to fix?

Rebrov, Konstantin via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 29 21:22:00 PDT 2021


Dear LLVM engineers,

My name is Konstantin Rebrov. I am trying to recreate a simple program using YAML I/O to read *.yaml files into in-memory data structures, and write those same data structures back out into a *.yaml file.
I am following the official documentation/tutorial
https://llvm.org/docs/YamlIO.html

After compilation, my simple program successfully wrote the data structures into the output.yaml file. Then I tried to make input work, using that same output.yaml file as the input.yaml file.
Unfortunately my program failed to parse the YAML file correctly, reporting such an error:

input_file2.yaml:1:1: error: not a sequence
-
^

It reports this error for the first character in the file. Even if I remove the "---" at the top of the file, it would still omit that error.
I think that I am just missing one tiny detail, that I don't know about yet. If there is anyone who has any some experience with YAML I/O, please help me solve this problem.

I wrote a detailed description of the exact error that I encountered, under what circumstances, and a full listing of my source code, in this StackOverflow post:
https://stackoverflow.com/q/67324812/5500589

Sincerely, Konstantin Rebrov
<Konstantin.rebrov at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210430/388a5fee/attachment-0001.html>


More information about the llvm-dev mailing list