import LIB/default.lm; import SRC/stable-ast.lm; import SRC/index-utility.lm; import SRC/index-types.lm; import SRC/stable-tokenize.lm; import SRC/stable-parse.lm; import SRC/stable-preprocess.lm; import SRC/stable-fragment.lm; import SRC/stable-context.lm; import SRC/stable-index.lm; import DOBY/doc.lm; type DobyMode DobyModeHelp | DobyModeDoc; config-doby-mode := (: DobyModeHelp DobyMode); config-doby-input := '[Doby]_s; main := λ(: argc U64)(: argv String[]). (: ( (let argi 1_u64) (let input SNil) (while (<( argi argc )) ( (match ([]( argv argi )) ( () ('doc_s (set config-doby-mode DobyModeDoc)) ('help_s (set config-doby-mode DobyModeHelp)) ('-o_s ( (set argi (+( argi 1_u64 ))) (set config-target ([]( argv argi ))) )) (fp ( (set config-doby-input fp) (set input (SCons( (close input) (close (SAtom( fp ))) ))) )) )) (set argi (+( argi 1_u64 ))) )) (let continue True_u8) (while (==( continue True_u8 )) (match input ( () ( SNil (set continue False_u8) ) ( (SCons( rst SNil )) (set input rst) ) ( (SCons( rst (SAtom( fp )) )) ( (tokenize fp) (set input rst) )) ( (SAtom( fp )) ( (tokenize fp) (set continue False_u8) )) ))) (match config-doby-mode ( () ( DobyModeHelp ( (print 'doby\shelp\s--\sDisplay\sCommand\sLine\sOptions\n_s) (print 'doby\sdoc\s[input]--\sGenerate\sDocumentation\n_s) (print '\s\s\s\s\s-o\s[target]\s--\sOutput\sDestination\n_s) )) ( DobyModeDoc ( (parse()) (preprocess()) (write-file( config-target (doc-render()) )) )) )) ) Nil);