base parseEnum on a case statement, fixes #14030 (#14046)

* base `parseEnum` on a case statement, fixes #14030

* apply simplifactions / clean up, remove `norm` node, use strVal

* export `normalize` in json.nim

* cmp using nimIdentNormalize, error at CT if ambiguous enum found

`nimIdentNormalize` provided by @cooldome.

We track all names of the branches we have created so far and error if
a duplicate is found.

Dummy change to make github react...

* fix docstring of `nimIdentNormalize`

* make `typ` arg `typedesc`, add lineinfo, call norm. only once
This commit is contained in:
Vindaar 2020-04-22 10:41:56 +02:00 • committed by GitHub
commit d42c5a575d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 171 additions and 11 deletions

View file

@ -158,7 +158,7 @@ export
export
parsejson.JsonEventKind, parsejson.JsonError, JsonParser, JsonKindError,
open, close, str, getInt, getFloat, kind, getColumn, getLine, getFilename,
errorMsg, errorMsgExpected, next, JsonParsingError, raiseParseErr
errorMsg, errorMsgExpected, next, JsonParsingError, raiseParseErr, nimIdentNormalize
type
JsonNodeKind* = enum ## possible JSON node types