jeremyw/stamp — pull request #18 by kbrock (2012-12-09 12:32:52+00:00)
Title: Strftime be gone

Jeremy-

Introduced an AST, that has knowledge of the various strftime formats.

It will still work with rails, since the date formatters support strftime strings or procs. Not sure about other libraries like simple form - that may depend upon strftime codes.

If you wanted to stick with using strftime to emit stuff, we could embed the strftime codes into the AST/emitter objects. But I thought going away from that buys you ordinals, lowercase am/pm and stuff in a clean way. (notice how it no longer takes the output date object while parsing the example text)

Wasn't sure how far to take the legacy bit, since the goal seems to tear that out.
I just didn't want to go too far on this track before checking in with you first.

Next steps would be to tokenize the strings and maybe go 2 passes. one to populate the easy ones, (2012, 24, 12 ) and the other to use locality to auto populate them look around for ":" delimiters.

Or I guess a treetop type parsers could work as well, but the structure is so simple/flat that a simple regex seemed to work just fine.

--K