Code Generation
This is the backend of Comonicon. Currently it can only generates a Julia AST.
References
Comonicon.CodeGen.ASTCtx — TypeASTCtxAST code generation context.
Comonicon.CodeGen.codegen — Functioncodegen(ctx, cmd)Generate target code according to given context ctx from a command object cmd.
Comonicon.CodeGen.codegen — Methodcodegen(cmd)Generate Julia AST from given command object cmd. This will wrap all the generated AST in a function command_main.
Comonicon.CodeGen.prettify — Methodprettify(ex)Prettify given expression, remove all LineNumberNode and extra code blocks.
Comonicon.CodeGen.pushmaybe! — Methodpush!(args, item)Push an item to the expression or list. Do nothing if the item is nothing.
Comonicon.CodeGen.read_arg — Methodread_arg(ctx::ASTCtx)Return the expression that read the next argument from ARGS.
Comonicon.CodeGen.rm_lineinfo — Methodrm_lineinfo(ex)Remove LineNumberNode in a given expression
Comonicon.CodeGen.xerror — Methodxerror(cmd, msg)Create an expression that contains error message, automatically merge interpolation expressions.
Comonicon.CodeGen.xmatch — Functionxmatch(regexes, actions, str[, st = 1])Generate a long ifelse expression that acts like a pattern matching expression that match given regex list and do the corresponding actions.