Skip to content

Fix strtotime#840

Open
Indigo744 wants to merge 2 commits intopeachpiecompiler:masterfrom
Indigo744:fix_strtotime
Open

Fix strtotime#840
Indigo744 wants to merge 2 commits intopeachpiecompiler:masterfrom
Indigo744:fix_strtotime

Conversation

@Indigo744
Copy link
Copy Markdown
Contributor

@Indigo744 Indigo744 commented Sep 1, 2020

strtotime fails with

  • strtotime("first monday of 2020-01")

And has wrong result for:

  • strtotime("2020-01")

I only added the test cases for now, but I have no idea how to tackle this. Any pointers?

@jakubmisek
Copy link
Copy Markdown
Member

I was checking the issue down to the actual time parser.

  1. The tokens like "first", "monday", etc. are parsed at Generators/StrToTime.lex (generated into Parsers\StrToTimeScanner.cs). Seems the parser does not know the "of" token at all.

  2. "2020-01" is also an unknown combination in the parser, it expects three numbers, not just two.

So it is possible to update the parser (StrToTime.lex) with the new "grammar". Technically it is just a lexer, so it's very simple pattern matching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants