Open godber opened 9 years ago
To do this task right, I think the grammar needs to be modified so that DATE
, TIME
, and DATE_TIME
are grammar rules rather than tokens, unless I can find out how to access the nested tokens from the visitor level.
Basically I am thinking the following rule:
date_time_value
: DATE
| TIME
| DATE_TIME
;
Should be something more along the line of:
date_time_value
: DIGIT DIGIT DIGIT DIGIT '-' DIGIT+ '-' DIGIT+ # YEAR_MONTH_DAY
| DIGIT DIGIT DIGIT DIGIT '-' DIGIT+ # YEAR_DOY
| HH_MM_SS # HH_MM_SS
| HH_MM_SS 'Z' # HH_MM_SS_Z
| HH_MM_SS SIGN DIGIT+ # HH_MM_SS_N
| DATE_TIME ...
;
Maybe not, since DATE_TIME is DATE 'T' TIME
.
Basically, what it comes down to is that in order to properly implement visitDate_time_value
I think I am going to have to do a lot of string matching that should automatically happen in the grammar. Maybe I just don't get how to use it fully yet.
Add support for date, time and datetime labels
https://github.com/godber/pds3label/blob/master/test/data/dates.lbl
Datetime strings in the PDS label should be returned as Python Datetime objects.