All syntaxes are mostly possible.

Here is one way, defining a syntax parsing word to get a string and convert
to a timestamp at parse time:

    USING: calendar.format lexer namespaces sequences strings.parser ;
    SYNTAX: TIME"
        lexer get skip-blank parse-string hm>timestamp suffix! ;

Then you could use it:

    IN: scratchpad TIME" 05:20" .
    T{ timestamp { hour 5 } { minute 20 } }

I could imagine adding support to pattern match other common patterns like:

    YYYY-MM-DD
    HH:MM:SS
    HH:MM:SS.sss
    etc.

Best,
John.

On Fri, Nov 11, 2016 at 5:51 AM, Alexander Ilin <ajs...@yandex.ru> wrote:

> Hello!
>
>   Do we support the time syntax directly? I mean, how hard would it be to
> enter `05:20` anywhere in the source, and have an instance of `timestamp`
> automatically created?
>
>   Otherwise we have to write `5 hours 20 minutes time+`, which is more
> verbose than necessary.
>
>   To disambiguate 5:00 minutes from 5:00 hours we could require all three
> components to be always present: 00:05:00, 05:00:00.
>
> ---=====---
>  Александр
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to