HsYAML
HsYAML copied to clipboard
test-case 9KAX
https://matrix.yaml.io/details/9KAX.html doesn't pass as of HsYAML-0.1.2.0 specifically because of
---
!!map
&a8 !!str key8: value7
which yaml2token decodes as
<stdin>:1:0: BeginDocument |
<stdin>:1:0: DirectivesEnd | ---
<stdin>:1:3: BeginNode |
<stdin>:1:3: BeginScalar |
<stdin>:1:3: EndScalar |
<stdin>:1:3: EndNode |
<stdin>:1:3: Break | \n
<stdin>:2:0: Unparsed | !!map
<stdin>:2:5: Unparsed | \n
<stdin>:3:0: Unparsed | "&a8 !!str key8: value7"
<stdin>:3:22: Unparsed | \n
<stdin>:4:0: EndDocument |
in other words, parsing chokes on the !!map token
TODO: review YAML 1.2 spec
I think the main source of the problem is production rule 200 in token.hs
It is a slightly improved version of the grammar production rule 200 in YAML 1.2 spec but still, some tweaks in this rule are required to fix this error.
For this example, it fails because we are not able to parse !!map as we are not able to detect s-l-comments in the look-ahead.
TODO: Review the definition of s_l_comments