scottcorgan / tap-out

A different tap parser
MIT License
23 stars 28 forks source link

fails to parse yaml block which includes a string with newlines #17

Open keithamus opened 8 years ago

keithamus commented 8 years ago

Summary

A yaml value supposedly can contain newline literals, which should be stripped out as part of the yaml value. tap-out crashes if it attempts to parse such a value.

So apparently the following is valid:

a: b
    c

and should result in the following json:

{
  "a": "b c"
}

in fact, on yaml.org within the first few lines it is demonstrated:

What It Is: YAML is a human friendly data serialization
  standard for all programming languages.

It seems to be in YAML 1.2 Example 2.18

Proposal

Currently the parser has a custom YAML parser included, which seemingly does not adhere to the YAML spec. I would suggest instead collecting the lines between --- and ... and passing them straight into a yaml parser. My suggestion would be to go with js-yaml as it claims to be 1.2 compliant and is actively maintained, has lots of github stars, and nearly 5 million npm downloads a month.

scottcorgan commented 8 years ago

I have been working on a collection of packages under the org tap-format as sequels to my few tap-[formatter] modules.

https://github.com/tap-format/parser will be the replacement for this. It's basically done, just needs documentation.

keithamus commented 8 years ago

Great work @scottcorgan! Kudos :grinning:. Does that mean that tap-out is deprecated?

scottcorgan commented 8 years ago

@keithamus it will be deprecated, but not quite yet. Once the tap-format modules are all polished and documented, then I'll put out the deprecation notice. I'll still maintain it, but it will be feature complete. It will just be in maintenance mode.