We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The existing dateRegexp accepts years with 1-3 digits. AFAIK, the TOML spec only allows 4-digit years.
dateRegexp
These should be pass, but they do:
diff --git a/lexer_test.go b/lexer_test.go index 225a52a..e5ac952 100644 --- a/lexer_test.go +++ b/lexer_test.go @@ -350,6 +350,24 @@ func TestKeyEqualDate(t *testing.T) { {Position{1, 7}, tokenDate, "1979-05-27 07:32:00Z"}, {Position{1, 27}, tokenEOF, ""}, }) + testFlow(t, "foo = 9-05-27 07:32:00Z", []token{ + {Position{1, 1}, tokenKey, "foo"}, + {Position{1, 5}, tokenEqual, "="}, + {Position{1, 7}, tokenDate, "9-05-27 07:32:00Z"}, + {Position{1, 24}, tokenEOF, ""}, + }) + testFlow(t, "foo = 79-05-27 07:32:00Z", []token{ + {Position{1, 1}, tokenKey, "foo"}, + {Position{1, 5}, tokenEqual, "="}, + {Position{1, 7}, tokenDate, "79-05-27 07:32:00Z"}, + {Position{1, 25}, tokenEOF, ""}, + }) + testFlow(t, "foo = 979-05-27 07:32:00Z", []token{ + {Position{1, 1}, tokenKey, "foo"}, + {Position{1, 5}, tokenEqual, "="}, + {Position{1, 7}, tokenDate, "979-05-27 07:32:00Z"}, + {Position{1, 26}, tokenEOF, ""}, + }) } func TestFloatEndingWithDot(t *testing.T) {
Only allow 4-digit years.
The text was updated successfully, but these errors were encountered:
Fix date lexer to only support 4-digit year
6f9d002
Fixes pelletier#441
Good catch! Thank you!
Sorry, something went wrong.
Fix date lexer to only support 4-digit year (#443)
a7448fe
Fixes #441
Successfully merging a pull request may close this issue.
Describe the Bug
The existing
dateRegexp
accepts years with 1-3 digits. AFAIK, the TOML spec only allows 4-digit years.To Reproduce
These should be pass, but they do:
Expected Behavior
Only allow 4-digit years.
Versions
The text was updated successfully, but these errors were encountered: