Lists with continuations not parsing correctly
mbklein opened this issue · 2 comments
mbklein commented
Description
According to the EDTF Specification, the string {..1984}
should mean "The year 1984 and all earlier years" (See Example 9 under Set representation here.). Instead, it throws a parser error. Same with the trailing "on or after" ..
indicator. Both work fine with square bracketed Set types.
Versions
edtf
v3.0.1 on node v14.8.0
Expected Behavior
> edtf.parse('{..1984}')
{
values: [ { type: 'Date', level: 0, values: [Array] } ],
level: 2,
type: 'List',
earlier: true
}
Actual Behavior
> edtf.parse('{..1984}')
Uncaught Error: Syntax error at line 1 col 2:
1 {..1984}
^
Unexpected ".". Instead, I was expecting to see one of the following:
[... 2451 lines deleted ...]
for "{..1984}"
at Parser.feed (/Users/mbk836/Workspace/meadow/priv/edtf/node_modules/nearley/lib/nearley.js:343:27)
at Function.parse (/Users/mbk836/Workspace/meadow/priv/edtf/node_modules/edtf/src/parser.js:37:32) {
offset: 1,
token: { value: '.' }
}
inukshuk commented
Interesting! The example 9 there seems to have been changed last year; it's possible that I misinterpreted the wrong example to mean that inclusive lists did not support the earlier/later prefix. It should be fixed now, thanks for reporting!
mbklein commented
Awesome! Thanks for the quick turnaround!