File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
autoload/vital/__vital__/Text Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ function! s:_value(input) abort
145
145
return s: _boolean (a: input )
146
146
elseif s: _match (a: input , ' \d\{4}-' )
147
147
return s: _datetime (a: input )
148
+ elseif s: _match (a: input , ' \d\{2}:' )
149
+ return s: _local_time (a: input )
148
150
elseif s: _match (a: input , ' [+-]\?\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\|\%(\.\d\+\%(_\d\+\)*\)\?[eE]\)' )
149
151
return s: _float (a: input )
150
152
elseif s: _match (a: input , ' [+-]\?\%(inf\|nan\)' )
@@ -236,6 +238,13 @@ function! s:_datetime(input) abort
236
238
return s: _consume (a: input , ' \d\{4}-\d\{2}-\d\{2}\%([T ]\d\{2}:\d\{2}:\d\{2}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2}:\d\{2}\)\?\)\?' )
237
239
endfunction
238
240
241
+ "
242
+ " Local Time
243
+ "
244
+ function ! s: _local_time (input ) abort
245
+ return s: _consume (a: input , ' \d\{2}:\d\{2}:\d\{2}\%(\.\d\+\)\?' )
246
+ endfunction
247
+
239
248
"
240
249
" Array
241
250
"
Original file line number Diff line number Diff line change @@ -433,6 +433,16 @@ function! s:suite.__parse__()
433
433
call s: assert .same (data.ld1, ' 1979-05-27' )
434
434
endfunction
435
435
436
+ function ! parse.local_time ()
437
+ let data = s: TOML .parse (join ([
438
+ \ ' lt1 = 07:32:00' ,
439
+ \ ' lt2 = 00:32:00.999999' ,
440
+ \] , " \n " ))
441
+
442
+ call s: assert .same (data.lt1, ' 07:32:00' )
443
+ call s: assert .same (data.lt2, ' 00:32:00.999999' )
444
+ endfunction
445
+
436
446
function ! parse.array ()
437
447
let data = s: TOML .parse (join ([
438
448
\ ' integers = [ 1, 2, 3 ]' ,
You can’t perform that action at this time.
0 commit comments