You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flow-style mapping within a block sequence item fails to parse. #40
Thanks for developing this useful parser!
I've encountered an issue where flow-style mappings, when nested as items within a block sequence, are not parsed successfully by tinyyaml.
To reproduce the issue, I used the following YAML data in a file (e.g., NG_example.yaml)
# NG Example (flow mapping in block sequence)
foo:
- {a: 1, b: 2, c: 3}
- {d: 4, e: 5, f: 6}
Here is the Lua code I used for parsing:
local tinyyaml = require("tinyyaml")
local filepath = "/path/to/NG_example.yaml"
local inputfile = io.open(filepath, "r")
local str = inputfile:read("*a")
local filecontent = tinyyaml.parse(str)
inputfile:close()
I expected tinyyaml to successfully parse the YAML and generate a Lua table with the following structure: { foo = { {a = 1, b = 2, c = 3}, {d = 4, e = 5, f = 6} } }
However, it resulted in the following error:
C:\Lua\LuaJIT-build\luajit.exe: ...\AppData\Roaming\luarocks\share\lua\5.1\tinyyaml.lua:730: failed to classify line: {a: 1, b: 2, c: 3}
stack traceback:
[C]: in function 'error'
...\AppData\Roaming\luarocks\share\lua\5.1\tinyyaml.lua:730: in function 'parsemap'
...\AppData\Roaming\luarocks\share\lua\5.1\tinyyaml.lua:582: in function 'parseseq'
...\AppData\Roaming\luarocks\share\lua\5.1\tinyyaml.lua:756: in function 'parsemap'
...\AppData\Roaming\luarocks\share\lua\5.1\tinyyaml.lua:816: in function 'parsedocuments'
...\AppData\Roaming\luarocks\share\lua\5.1\tinyyaml.lua:841: in function 'parse'
c:\Lua\LuaJIT-build\works\test.lua:5: in main chunk
[C]: at 0x00253200
Additional Information
The following YAML, which uses a flow sequence, is parsed successfully:
# OK Example (flow mapping in flow sequence)
foo: [
{a: 1, b: 2, c: 3},
{d: 4, e: 5, f: 6}]
Activity