Given a fairly simple parser for "key=value" style input names_params.txt and using the compileDDLWith TH-generated parser, there is not much error information provided on parse failures.
$ cabal run exe:daedalus run -- names_params.ddl -i <(echo " min-length = 5; max-length=8; min-longth=3")
--- Parse error:
[offset: 36]
• expected 'e' while matching "min-length"
• see grammar at: names_params.ddl:25:5--25:19
• context:
• names_params.ddl:4:10--4:28
• names_params.ddl:13:69--13:80
• names_params.ddl:13:76--13:80
• minLength
• names_params.ddl:20:17--20:47
• input trace:
/dev/fd/63
0--36
File context:
Length: 40 (0x28) bytes
0000: 2d 6c 65 6e 67 74 68 20 3d 20 35 3b -length = 5;
0010: 20 6d 61 78 2d 6c 65 6e 67 74 68 3d 38 3b 20 6d max-length=8; m
0020: 69 6e 2d 6c 6f 6e 67 74 68 3d 33 0a in-longth=3.
Notably:
peLoc always seems to be a null string for errorLevel=1 and is inscrutable for errorLevel greater than one (for the above: peLoc = "DETERMINIZE 1 Fully"). I had expected this to provide location information in the input; currently I'm extracting that from peInput.off, which may be the recommended method, but I'm unsure as peLoc has no documentation.
peStack always seems to be an empty list for errorLevel=1, but is not particularly helpful for errorLevel greater than one (for the above: peStack = [[":ManyBody_113"],[":Many_114",":Many_114","names_params.ddl:5:5--5:39:Many_114"]], where only the last entry is somewhat useful).
peMsg is sometimes a null string (as seen above), and seems unaffected by errorLevel values.
Given a fairly simple parser for "key=value" style input names_params.txt and using the
compileDDLWith
TH-generated parser, there is not much error information provided on parse failures.Compare this to:
Notably:
peLoc
always seems to be a null string forerrorLevel=1
and is inscrutable forerrorLevel
greater than one (for the above:peLoc = "DETERMINIZE 1 Fully"
). I had expected this to provide location information in the input; currently I'm extracting that frompeInput.off
, which may be the recommended method, but I'm unsure aspeLoc
has no documentation.peStack
always seems to be an empty list forerrorLevel=1
, but is not particularly helpful forerrorLevel
greater than one (for the above:peStack = [[":ManyBody_113"],[":Many_114",":Many_114","names_params.ddl:5:5--5:39:Many_114"]]
, where only the last entry is somewhat useful).peMsg
is sometimes a null string (as seen above), and seems unaffected byerrorLevel
values.