RosettaCodeData/Task/Read-a-configuration-file/TXR/read-a-configuration-file.txr
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

24 lines
462 B
Text

@(collect)
@ (cases)
#@/.*/
@ (or)
;@/.*/
@ (or)
@{IDENT /[A-Z_][A-Z_0-9]+/}@/ */
@(bind VAL ("true"))
@ (or)
@{IDENT /[A-Z_][A-Z_0-9]+/}@(coll)@/ */@{VAL /[^,]+/}@/ */@(end)
@ (or)
@{IDENT /[A-Z_][A-Z_0-9]+/}@(coll)@/ */@{VAL /[^, ]+/}@/,? */@(end)
@(flatten VAL)
@ (or)
@/ */
@ (or)
@ (throw error "bad configuration syntax")
@ (end)
@(end)
@(output)
@ (repeat)
@IDENT = @(rep)@VAL, @(first){ @VAL, @(last)@VAL };@(single)@VAL;@(end)
@ (end)
@(end)