Commit Graph

4 Commits

Author SHA1 Message Date
wata_mac 636e660fac json: Add ParseExpression function 2020-09-04 14:12:01 -07:00
Kazuma Watanabe e72341df8a
json: Add json.ParseWithStartPos function
This is like json.Parse but allows specifying a non-default start position,
in case the caller is parsing a fragment from a larger JSON document.
2020-08-24 10:53:10 -07:00
Alisdair McDiarmid b265bbd046 json: Fix panic when parsing malformed JSON
When scanning JSON, upon encountering an invalid token, we immediately
return. Previously this return happened without inserting an EOF token.
Since other functions assume that a token sequence always ends in EOF,
this could cause a panic.

This commit adds a synthetic EOF token after the invalid token before
returning. While this does not match the real end-of-file of the source
JSON, it is marking the end of the scanned bytes, so it seems reasonable.

Fixes #339
2020-03-25 16:40:36 -04:00
Martin Atkins 6c4344623b Unfold the "hcl" directory up into the root
The main HCL package is more visible this way, and so it's easier than
having to pick it out from dozens of other package directories.
2019-09-09 16:08:19 -07:00