summaryrefslogtreecommitdiff
path: root/json/public.go
diff options
context:
space:
mode:
authorMartin Atkins <mart@degeneration.co.uk>2020-08-24 10:43:03 -0700
committerMartin Atkins <mart@degeneration.co.uk>2020-08-24 11:35:03 -0700
commit90676d47a0ce038f02596e2aa5894bf0c57fad56 (patch)
tree948feb1232b4944d3596e3dc8d3dee434aa6f62b /json/public.go
parenta484440c536e426d2138411f8111ace1ce6d285b (diff)
hclsyntax: Tailored error for "curly quotes"
It seems to be somewhat common for someone to share HCL code via a forum or a document and have the well-meaning word processor or CMS replace the straight quotes with curly quotes, which then lead to confusing errors when someone copies the result and tries to use it as valid HCL configuration. Here we add a special hint for that, giving a tailored error message instead of the generic "This character is not used within the language" error message. HCL has always had some of these special hints implemented here, and they were originally implemented with special token types to allow the parser handle them. However, we later refactored to do the check all at once inside the Lex* family of functions, prior to parsing, so it's now relatively straightforward to handle it as a special case of TokenInvalid rather than an entirely new token type. Perhaps later we'll rework the existing ones to also just use TokenInvalid, but that's a decision for another day.
Diffstat (limited to 'json/public.go')
0 files changed, 0 insertions, 0 deletions