thank you all for input on my little question. by now i'm quite sure i
can't trick the ruby parser in accepting 10:30 for anything else than a
syntax error. But i'm quite happy with the propsals, the one i like best
is:
'from 1030 to 1130'
this is reasonable close to what i had in mind(but what is with '0900'
Illegal octal digit?). the basic idea is a console based time accounting
implemented as an internal DSL with:
02.10 10:15-21:30 # a days work
13:45-15:15 # time span: task with begin and end time
0:45 # duration: a task given as duration in hours and
minutes
1.5 # a task given as fractions of hours an minutes
but with the feedback from this list i think i go for an external
DSL(http://www.martinfowler.com/bliki/DomainSpecificLanguage.html).
Regex based parsing should be easy enough. This is because '10_30' and
the octal problems with '0900' might be solvable, but DSL should be for
humans, not for parsers. And that was:
02.10 11:00-
0:30 timepoint DSL # thirty minutes on ruby-forum.
have fun
dirk
Matthias Reitinger wrote:
> David Vallner wrote:
>>> I mean, it is not that bad, but still.
>>> dirk
>>>
>>> ps.: of course i can always parse it,
>>>
>>>
>>
>> I'd just use the 'from 1030 to 1130' notation - hopefully you don't need
>> to use both time values and integers in the same context.
>
> You could also use 'from 10_30 to 11_30', which is similar in semantics
> but
> a little easier to read.
--
Posted via http://www.ruby-forum.com/.