44 lines
884 B
Text
44 lines
884 B
Text
@(define float (f))@\
|
|
@(local (tok))@\
|
|
@(cases)@\
|
|
@{tok /[+\-]?\d+\.\d*([Ee][+\-]?\d+)?/}@\
|
|
@(or)@\
|
|
@{tok /[+\-]?\d*\.\d+([Ee][+\-]?\d+)?/}@\
|
|
@(or)@\
|
|
@{tok /[+\-]?\d+[Ee][+\-]?\d+/}@\
|
|
@(end)@\
|
|
@(bind f @(flo-str tok))@\
|
|
@(end)
|
|
@(define int (i))@\
|
|
@(local (tok))@\
|
|
@{tok /[+\-]?\d+/}@\
|
|
@(bind i @(int-str tok))@\
|
|
@(end)
|
|
@(define sym (s))@\
|
|
@(local (tok))@\
|
|
@{tok /[^\s()]+/}@\
|
|
@(bind s @(intern tok))@\
|
|
@(end)
|
|
@(define str (s))@\
|
|
@(local (tok))@\
|
|
@{tok /"(\\"|[^"])*"/}@\
|
|
@(bind s @[tok 1..-1])@\
|
|
@(end)
|
|
@(define atom (a))@\
|
|
@(cases)@\
|
|
@(float a)@(or)@(int a)@(or)@(str a)@(or)@(sym a)@\
|
|
@(end)@\
|
|
@(end)
|
|
@(define expr (e))@\
|
|
@(cases)@\
|
|
@/\s*/@(atom e)@\
|
|
@(or)@\
|
|
@/\s*\(\s*/@(coll :vars (e))@(expr e)@/\s*/@(last))@(end)@\
|
|
@(end)@\
|
|
@(end)
|
|
@(freeform)
|
|
@(expr e)@junk
|
|
@(output)
|
|
expr: @(format nil "~s" e)
|
|
junk: @junk
|
|
@(end)
|