# TOC * [-](#-) * [EB](#EB) * [PS](#PS) * [abs](#abs) * [after](#after) * [align](#align) * [anon](#anon) * [append](#append) * [assert](#assert) * [capture](#capture) * [ceil](#ceil) * [chars](#chars) * [chomp](#chomp) * [clear](#clear) * [comma](#comma) * [comment](#comment) * [comp](#comp) * [count](#count) * [counter](#counter) * [countl](#countl) * [countw](#countw) * [cut](#cut) * [date](#date) * [declare](#declare) * [define](#define) * [dnl](#dnl) * [docu](#docu) * [dropcsv](#dropcsv) * [dump](#dump) * [empty](#empty) * [enl](#enl) * [env](#env) * [envset](#envset) * [eq](#eq) * [escape](#escape) * [eval](#eval) * [evalk](#evalk) * [exec](#exec) * [exist](#exist) * [exit](#exit) * [expand](#expand) * [extract](#extract) * [fassert](#fassert) * [fileout](#fileout) * [find](#find) * [findm](#findm) * [floor](#floor) * [fold](#fold) * [foldl](#foldl) * [forby](#forby) * [foreach](#foreach) * [forline](#forline) * [forloop](#forloop) * [ftime](#ftime) * [grep](#grep) * [grepf](#grepf) * [grepl](#grepl) * [grepmap](#grepmap) * [gt](#gt) * [gte](#gte) * [halt](#halt) * [head](#head) * [headl](#headl) * [hms](#hms) * [hygiene](#hygiene) * [if](#if) * [ifdef](#ifdef) * [ifdefel](#ifdefel) * [ifelse](#ifelse) * [ifenv](#ifenv) * [ifenvel](#ifenvel) * [ifque](#ifque) * [import](#import) * [include](#include) * [incread](#incread) * [indent](#indent) * [index](#index) * [indexl](#indexl) * [input](#input) * [isempty](#isempty) * [istype](#istype) * [iszero](#iszero) * [join](#join) * [joinl](#joinl) * [len](#len) * [let](#let) * [letr](#letr) * [lipsum](#lipsum) * [listdir](#listdir) * [log](#log) * [loge](#loge) * [logm](#logm) * [lower](#lower) * [lp](#lp) * [lt](#lt) * [lte](#lte) * [map](#map) * [mapf](#mapf) * [mapl](#mapl) * [max](#max) * [min](#min) * [name](#name) * [nassert](#nassert) * [nl](#nl) * [not](#not) * [notat](#notat) * [num](#num) * [ostype](#ostype) * [panic](#panic) * [parent](#parent) * [path](#path) * [pause](#pause) * [pipe](#pipe) * [pipeto](#pipeto) * [prec](#prec) * [que](#que) * [query](#query) * [readin](#readin) * [readto](#readto) * [regcsv](#regcsv) * [regex](#regex) * [regexpr](#regexpr) * [relay](#relay) * [rename](#rename) * [repeat](#repeat) * [repl](#repl) * [require](#require) * [rev](#rev) * [rp](#rp) * [scut](#scut) * [sep](#sep) * [slice](#slice) * [sort](#sort) * [sortl](#sortl) * [source](#source) * [space](#space) * [split](#split) * [spread](#spread) * [squash](#squash) * [ssplit](#ssplit) * [static](#static) * [staticr](#staticr) * [strict](#strict) * [strip](#strip) * [stripf](#stripf) * [stripr](#stripr) * [sub](#sub) * [surr](#surr) * [syscmd](#syscmd) * [tab](#tab) * [table](#table) * [tail](#tail) * [taill](#taill) * [temp](#temp) * [tempin](#tempin) * [tempout](#tempout) * [tempto](#tempto) * [time](#time) * [tr](#tr) * [trim](#trim) * [triml](#triml) * [trimla](#trimla) * [undef](#undef) * [unicode](#unicode) * [until](#until) * [update](#update) * [upper](#upper) * [wrap](#wrap) # Macros ### - Macro Type : Function Macro Name : - Arguments : ["a_pipe_name?^"] Usage : $-(a_pipe_name?^) Description >> Get a piped value. This truncates an original value by default if not configured other # Arguments - a_pipe_name : A name of pipe ( trimmed, optional ) # Exmaple $eval|(1+2) $assert(3,$-()) $nassert(3,$-()) $pipeto(num,5) $assert(5,$-(num)) ### EB Macro Type : Deterred Macro Name : EB Arguments : [] Usage : $EB() Description >> Escape all following blanks until not. This can only be invoked at first level # NOT deterred # Example $EB() ### PS Macro Type : Function Macro Name : PS Arguments : [] Usage : $PS() Description >> Return platform specific path separator - On windows, this return '\' - On non windows, this return '/' # Exmaple $assert(c,$cut($PS(),-1,a/b/c)) ### abs Macro Type : Function Macro Name : abs Arguments : ["a_path^"] Usage : $abs(a_path^) Description >> Get an absolute path. This requires a path to be a real path. # Auth : FIN # Return : path # Arguments - a_path : A path to make it absolute ( trimmed ) # Example $assert(/home/user/cwd/test.md,$abs(test.md)) ### after Macro Type : Function Macro Name : after Arguments : ["a_pattern", "a_content"] Usage : $after(a_pattern,a_content) Description >> Get a substring after a pattern # Arguments - a_pattern : A pattern to find - a_content : A content to get a sub string # Example $assert(world,$after($space(),Hello world)) ### align Macro Type : Function Macro Name : align Arguments : ["a_type^", "a_width^", "a_fill^", "a_text"] Usage : $align(a_type^,a_width^,a_fill^,a_text) Description >> Align texts with character filler # Arguments - a_type : Types of alignment ["Left", "right", "center"] ( trimmed ) - a_width : Total width of aligned chunk [ Unsigned integer ] ( trimmed ) - a_fill : A character to fill ( trimmed ) - a_text : Text to align # Example $assert(Hello***,$align(left ,8,*,Hello)) $assert(***Hello,$align(right ,8,*,Hello)) $assert(**Hello*,$align(center,8,*,Hello)) ### anon Macro Type : Deterred Macro Name : anon Arguments : ["a_macro"] Usage : $anon(a_macro) Description >> Create an anonymous macro and return it's name # Not expanded at all # Arguments - a_macro : A macro defintition without name # Example $map($anon(a=$a()+),a,b,c) ### append Macro Type : Deterred Macro Name : append Arguments : ["a_macro_name^", "a_content", "a_trailer+"] Usage : $append(a_macro_name^,a_content,a_trailer+) Description >> Append contents to a macro. If the macro doesn't exist, yields error - If given a "trailer", the macro checks if target macro has a trailer and append if not. - If a macro body is empty, trailer is not appended # NOT deterred # Arguments - a_macro_name : a macro name to append to ( trimmed ) - a_content : contents to be added - a_trailer : A trailer to append before content ( Optional ) # Example $define(container=Before) $append(container,$space()After) $assert($container(),Before After) $define(arr=) $append(arr,first,$comma()) $append(arr,second,$comma()) $assert($arr(),first,second) ### assert Macro Type : Function Macro Name : assert Arguments : ["a_lvalue", "a_rvalue"] Usage : $assert(a_lvalue,a_rvalue) Description >> Compare lvalue and rvalue, panics with two values are not equal # Arguments - a_lvalue : Left value to compare - a_rvalue : Right value to compare # Example % Succeed $assert(1,1) % Fails $assert(a,b) ### capture Macro Type : Function Macro Name : capture Arguments : ["a_expr", "a_text"] Usage : $capture(a_expr,a_text) Description >> Capture all matched expressions delimited by newline # Arguments - a_expr : A regex expression to match - a_text : A text to get expressions # Example $capture|(test.[1-9],test 1 test 2 test 3) $assert($-(),test 1 test 2 test 3) ### ceil Macro Type : Function Macro Name : ceil Arguments : ["a_number^"] Usage : $ceil(a_number^) Description >> Get ceiling of a number # Return : Signed integer # Arguments - a_number : A number to get a ceiling from [float] ( trimmed ) # Example $assert($ceil(0.9),1) $assert($ceil(3.1),4) ### chars Macro Type : Function Macro Name : chars Arguments : ["a_text^"] Usage : $chars(a_text^) Description >> Get a characters array from text # Arguments - a_text : Text to get a chars array from ( trimmed ) # Example $assert(a,b,c,d,e$chars(abcde)) ### chomp Macro Type : Function Macro Name : chomp Arguments : ["a_content"] Usage : $chomp(a_content) Description >> Remove duplicate newlines from content # Arguments - a_content: Contents to chomp # Example $staticr(lines,Upper Down) $assert($countl($lines()),4) $assert($countl($chomp($lines())),3) ### clear Macro Type : Function Macro Name : clear Arguments : [] Usage : $clear() Description >> Clear volatile macros. This macro is intended to be used when hygiene mode is enabled and user wants to clear volatiles immediately without waiting. # Example $clear() ### comma Macro Type : Function Macro Name : comma Arguments : [] Usage : $comma() Description >> Print a comma # Example $assert(,,$comma()) ### comment Macro Type : Function Macro Name : comment Arguments : ["a_comment_type^"] Usage : $comment(a_comment_type^) Description >> Requires comment type # Arguments - a_comment_type: A comment type to require. ( trimmed ) ["none", "start", "any"] # Example $comment(start) ### comp Macro Type : Function Macro Name : comp Arguments : ["a_content"] Usage : $comp(a_content) Description >> Apply both trim and chomp (compress) to contents # Arguments - a_content : Content to compress # Example $staticr(lines, upper down ) $assert($countl($lines()),5) $assert($countl($comp($lines())),3) ### count Macro Type : Function Macro Name : count Arguments : ["a_array"] Usage : $count(a_array) Description >> Get counts of an array # Return : Unsigned integer # Arguments - a_array : An array to get counts from # Example $assert($count(a,b,c),3) ### counter Macro Type : Function Macro Name : counter Arguments : ["a_macro_name^", "a_counter_type^+"] Usage : $counter(a_macro_name^,a_counter_type^+) Description >> Increae/decrease counter macro. - Counter macro is automatically defined if the macro doesn't exist - Counter's value should be a number and can be negative. # Arguments - a_macro_name : A macro name to use as counter ( trimmed ) - a_counter_type : A counter opration type. Default is plus [ "plus", "minus" ] ( trimmed ) # Example $define(ct=0) $counter(ct) $counter(ct) $counter(ct,minus) $assert($ct(),3) $counter(ct,minus) $assert($ct(),2) ### countl Macro Type : Function Macro Name : countl Arguments : ["a_lines"] Usage : $countl(a_lines) Description >> Get counts of lines. # Return : Unsigned integer # Arguments - a_lines : Lines to get counts from # Example $assert(3,$countl(1 2 3)) ### countw Macro Type : Function Macro Name : countw Arguments : ["a_array"] Usage : $countw(a_array) Description >> Get count of words # Return : Unsigned integer # Arguments - a_array : An array to get word counts from # Example $assert($countw(hello world),2) ### cut Macro Type : Function Macro Name : cut Arguments : ["a_sep", "a_index", "a_text"] Usage : $cut(a_sep,a_index,a_text) Description >> Split text and cut from splitted array # Arguments - a_sep : A separator string - a_index : An index to cut out - a_text : Text to split # Example $assert(b,$cut(/,-2,a/b/c)) ### date Macro Type : Function Macro Name : date Arguments : [] Usage : $date() Description >> Get current local date without timezone # Example % yyyy-MM-dd $date() ### declare Macro Type : Function Macro Name : declare Arguments : ["a_macro_names^"] Usage : $declare(a_macro_names^) Description >> Declare multiple variables separated by commas # Arguments - a_macro_names: Macro names array ( trimmed ) # Example $declare(first,second) $assert($first(),$empty()) ### define Macro Type : Function Macro Name : define Arguments : ["a_define_statement"] Usage : $define(a_define_statement) Description >> Define a macro # Arguments Define should follow handful of rules - Macro name, parameter name should start non number characters. - Consequent characters for macro names, parameter names can be underscore or any characters except special characters. - Parameters starts with comma and should be separated by whitespaces - Macro body starts with equal(=) characters # Example $define(test=Test) $define(demo,a_1 a_2=$a_1() $a_2()) $assert($test(),Test) $assert(wow cow,$demo(wow,cow)) ### dnl Macro Type : Function Macro Name : dnl Arguments : [] Usage : $dnl() Description >> Deny a next newline. This technically squashes following two consequent line_ending into a single one - dnl doesn't deny right next newlie but a newline after a newline. # Example $assert(a$nl()b,a$dnl() b) ### docu Macro Type : Function Macro Name : docu Arguments : ["a_macro_name^", "a_doc"] Usage : $docu(a_macro_name^,a_doc) Description >> Append documents(description) to a macro. You cannot directly retreive documentation from macros but by --man flag. # Arguments - a_macro_name : A macro to append documentation ( trimmed ) - a_doc : Documents to append # Example $define(test=) $docu(test,This is test macro) ### dropcsv Macro Type : Function Macro Name : dropcsv Arguments : ["a_table_name^"] Usage : $dropcsv(a_table_name^) Description >> Drop a csv table # Arguments - a_table_name : A csv table name to drop ( trimmed ) # Example $dropcsv(table1) ### dump Macro Type : Function Macro Name : dump Arguments : ["a_file_name^"] Usage : $dump(a_file_name^) Description >> Dump(truncate) given files' content # Arguments - a_file_name: File's name to dump ( trimmed ) # Example $dump(file.txt) $assert($empty(),$include(file.txt)) ### empty Macro Type : Function Macro Name : empty Arguments : [] Usage : $empty() Description >> Print empty string. Used for semantic formatting. # Example $assert(,$empty()) ### enl Macro Type : Function Macro Name : enl Arguments : [] Usage : $enl() Description >> Escape a following newline # Example $assert(ab,a$enl() b) ### env Macro Type : Function Macro Name : env Arguments : ["a_env_name^"] Usage : $env(a_env_name^) Description >> Get an environment variable # Auth : ENV # Arguments - a_env_name : An environment variable name to get (trimmed) # Example $assert(/home/user/dir,$env(HOME)) ### envset Macro Type : Function Macro Name : envset Arguments : ["a_env_name^", "a_env_value"] Usage : $envset(a_env_name^,a_env_value) Description >> Set an environment variable # Auth : ENV # Arguments - a_env_name : An environment variable name to set (trimmed) - a_env_value : A value to set # Example $envset(HOME,/tmp) ### eq Macro Type : Function Macro Name : eq Arguments : ["a_lvalue", "a_rvalue"] Usage : $eq(a_lvalue,a_rvalue) Description >> Check if given values are same # Return : Boolean # Arguments - a_lvalue : A left value to compare - a_rvalue : A right value to cmpare # Example $assert(false,$eq(a,b)) $assert(true,$eq(23,23)) ### escape Macro Type : Function Macro Name : escape Arguments : [] Usage : $escape() Description >> Escape processing from the invocation. - NOTE : This flow control only sustains for the input. # Example $escape() ### eval Macro Type : Function Macro Name : eval Arguments : ["a_expr"] Usage : $eval(a_expr) Description >> Evaluate a given expression - This macro redirects expression to evalexpr crate # Arguments - a_expr : An expression to evaluate # Example $assert(3,$eval(1 + 2)) $assert(true,$eval("string" == "string")) ### evalk Macro Type : Function Macro Name : evalk Arguments : ["a_expr"] Usage : $evalk(a_expr) Description >> Evaluate an expression while keeping source text - This macro redirects an expression to evalexpr crate # Arguments - a_expr : An expression to evaluate # Example $assert(1 + 2 = 3,$evalk(1 + 2 )) ### exec Macro Type : Deterred Macro Name : exec Arguments : ["a_macro_name^", "a_macro_args"] Usage : $exec(a_macro_name^,a_macro_args) Description >> Execute a macro with arguments # NOT deterred # Arguments - a_macro_name : A macro name to exectue ( trimmed ) - a_macro_args : Arguments to be passed to a macro # Example $assert($path(a,b,c),$exec(path,a,b,c)) ### exist Macro Type : Function Macro Name : exist Arguments : ["a_filename^"] Usage : $exist(a_filename^) Description >> Chck if file exists # Auth : FIN # Arguments - a_filename : A file name to audit ( trimmed ) # Example $exist(file.txt) ### exit Macro Type : Function Macro Name : exit Arguments : [] Usage : $exit() Description >> Exit processing from the invocation - NOTE : This flow control only sustains for the input # Example $exit() ### expand Macro Type : Deterred Macro Name : expand Arguments : ["a_literal_expr"] Usage : $expand(a_literal_expr) Description >> Expand expression # Note - This will strip a given expression and then expand it. # Arguments - a_expr : An expression to expand # Example $expand(1,2,3) ### extract Macro Type : Function Macro Name : extract Arguments : [] Usage : $extract() Description >> Extract from a storage # Example $extract() ### fassert Macro Type : Deterred Macro Name : fassert Arguments : ["a_expr"] Usage : $fassert(a_expr) Description >> Assert succeeds when text expansion yields error # NOT deterred # Arguments - a_expr: An expression to audit # Example $fassert($eval(Text is not allowd)) ### fileout Macro Type : Function Macro Name : fileout Arguments : ["a_filename^", "a_truncate?^", "a_content"] Usage : $fileout(a_filename^,a_truncate?^,a_content) Description >> Write content to a file # Auth : FOUT # Arguments - a_filename : A file name to write ( trimmed ) - a_truncate : Whether to truncate before writing [boolean] ( trimmed ) - a_content : Content to write to the file # Example $fileout(/tmp/some_file.txt,true,Hello World) ### find Macro Type : Function Macro Name : find Arguments : ["a_expr", "a_source"] Usage : $find(a_expr,a_source) Description >> Check an occurrence of expression from source. # Return : Boolean # Arguments - a_expr : An expression to match - a_source : Source to match for # Example $assert(true,$find(^abc,abcde)) ### findm Macro Type : Function Macro Name : findm Arguments : ["a_expr", "a_source"] Usage : $findm(a_expr,a_source) Description >> Get occurrences of expression from source. This returns 0 if there are no occurrences. # Return : Unsigned integer # Arguments - a_expr : An expression to match - a_source : Source to match for # Example $assert(2,$findm(o,hello world)) ### floor Macro Type : Function Macro Name : floor Arguments : ["a_number^"] Usage : $floor(a_number^) Description >> Get a floor integer from a given number # Return : Signed integer # Arguments - a_number : A number to get a floor from [float] ( trimmed ) # Example $assert($floor( 1.9),1) $assert($floor(-3.1),-4) ### fold Macro Type : Function Macro Name : fold Arguments : ["a_array"] Usage : $fold(a_array) Description >> Fold an array into a single value # Arguments - a_array : An array to fold # Example $assert(abc,$fold(a,b,c)) ### foldl Macro Type : Function Macro Name : foldl Arguments : ["a_lines"] Usage : $foldl(a_lines) Description >> Fold lines into a single value # Arguments - a_lines : Lines to fold # Example $assert(abc,$foldl(a b c)) ### forby Macro Type : Deterred Macro Name : forby Arguments : ["a_body", "a_sep", "a_text"] Usage : $forby(a_body,a_sep,a_text) Description >> Iterate around text separated by separator. Iterated value is bound to macro ":" # Expansion order 1. a_sep : Expanded on time 2. a_text : Expanded on time 3. a_body : Split text by separator, and expanded by per item. # Arguments - a_body : A body to be pasted as iterated item - a_sep : A separator to split a text - a_text : Text to split by separator # Example $assert(a+b+c+,$forby($:()+,-,a-b-c)) ### foreach Macro Type : Deterred Macro Name : foreach Arguments : ["a_body", "a_array^"] Usage : $foreach(a_body,a_array^) Description >> Iterate around given array. An iterated value is bound to macro ":" # Expansion order 1. a_array : Expanded on time 2. a_body : Split array by comma, and expanded by per item. # Arguments - a_body : A body to be pasted as iterated item - a_array : An array to iterate ( trimmed ) # Example $assert(a+b+c+,$foreach($:()+,a,b,c)) ### forline Macro Type : Deterred Macro Name : forline Arguments : ["a_body", "a_lines^"] Usage : $forline(a_body,a_lines^) Description >> Loop around given lines separated by newline chraracter. An iterated value is bound to macro ":" # Expansion order 1. a_lines : Expanded on time 2. a_body : Split lines by newline, and expanded by per item. ( trimmed ) # Arguments - a_body : A body to be pasted as iterated item - a_lines : Lines to iterate # Example $assert(a+b+c+,$forline($:()+,a$nl()b$nl()c)) ### forloop Macro Type : Deterred Macro Name : forloop Arguments : ["a_body", "a_min^", "a_max^"] Usage : $forloop(a_body,a_min^,a_max^) Description >> Iterate around given range (min,max). An iterated value is bound to macro ":" # Expansion order 1. a_min : Expanded on time 2. a_max : Expanded on time 3. a_body : Creates a range of numbers from min+max pair, and expanded by per item. # Arguments - a_body : A body to be pasted as iterated item - a_min : A start index ( trimmed ) - a_max : A end index ( trimmed ) # Example $assert(1+2+3+,$forloop($:()+,1,3)) ### ftime Macro Type : Function Macro Name : ftime Arguments : ["a_file"] Usage : $ftime(a_file) Description >> Get a file's last modified time. # Arguments - a_file : A file to get last modified time ( trimmed ) # Example $ftime(some_file.txt) % 2022-07-07 19:07:06 ### grep Macro Type : Function Macro Name : grep Arguments : ["a_expr", "a_array"] Usage : $grep(a_expr,a_array) Description >> Extract matched items from given array. This returns all items as array # Arguments - a_expr : A regex expression to match - a_lines : An array to get matches from # Example $assert(a,b,c,$grep([a-z],a,b,c,1,2)) ### grepf Macro Type : Function Macro Name : grepf Arguments : ["a_expr", "a_file^"] Usage : $grepf(a_expr,a_file^) Description >> Extract matched lines from given file. This returns all items as lines - NOTE : The grep operation is executed on per line and doesn't expand lines # Arguments - a_expr : A regex expression to match - a_lines : A file get matches from # Example $countl($grepf(file.txt)) ### grepl Macro Type : Function Macro Name : grepl Arguments : ["a_expr", "a_lines"] Usage : $grepl(a_expr,a_lines) Description >> Extract matched lines from given lines. This returns all lines that matches a given expression # Arguments - a_expr : A regex expression to match - a_lines : Lines to get matches from # Example $assert(2,$countl($grepl(Cargo,$syscmd(ls)))) ### grepmap Macro Type : Deterred Macro Name : grepmap Arguments : ["a_grep_type^", "a_expr", "a_macro_name^", "a_text"] Usage : $grepmap(a_grep_type^,a_expr,a_macro_name^,a_text) Description >> Capture expressions and apply a macro to each captured expression # Auth : FIN # Note - If grep type is file, grep operation is executed on per line. - If grep type is text, grep operation is executed one whole text. # Arguments - a_grep_type : Grep type to execute. ["text", "file" ] - a_expr : An expression to match - a_macro_name : A macro name to execute on each captured string - a_text : Source text to find expressions # Example $define(ss,a_text=$sub(2,,$a_text())$nl()) $assert(c$nl()d$nl()e,$grepmap^(text,ab.,ss,abc abd abe)) ### gt Macro Type : Function Macro Name : gt Arguments : ["a_lvalue", "a_rvalue"] Usage : $gt(a_lvalue,a_rvalue) Description >> Check if lvalue is greater than rvalue # Return : Boolean # Arguments - a_lvalue : A left value to compare - a_rvalue : A right value to compare # Example $assert(true,$gt(c,b)) $assert(false,$gt(text,text)) ### gte Macro Type : Function Macro Name : gte Arguments : ["a_lvalue", "a_rvalue"] Usage : $gte(a_lvalue,a_rvalue) Description >> Check if lvalue is greater than or equal to rvalue # Return : Boolean # Arguments - a_lvalue : A left value to compare - a_rvalue : A right value to compare # Example $assert(true,$gte(c,b)) $assert(true,$gte(text,text)) ### halt Macro Type : Function Macro Name : halt Arguments : [] Usage : $halt() Description >> Halt relaying - NOTE : Halt is automatically queued by default. Feed an optional argument to configure this behaviour - $halt(false) == $halt() - use $halt(true) to immediately halt # Example $define(cont=) $relay(macro,cont) 12345 $halt() $assert(12345,$cont^()) ### head Macro Type : Function Macro Name : head Arguments : ["a_count^", "a_content"] Usage : $head(a_count^,a_content) Description >> Crop head texts from given content # Arguments - a_count : Amount of characters to crop [unsigned integer] ( trimmed ) - a_content : Text to crop from # Example $assert(Hello~,$head( 6 ,Hello~ World)) ### headl Macro Type : Function Macro Name : headl Arguments : ["a_count^", "a_lines"] Usage : $headl(a_count^,a_lines) Description >> Crop head texts but as lines from given content # Arguments - a_count : Amount of lines to crop [unsigned integer] ( trimmed ) - a_lines : Lines to crop from # Example $assert(2,$countl($headl( 2 ,a b c))) ### hms Macro Type : Function Macro Name : hms Arguments : ["a_second^"] Usage : $hms(a_second^) Description >> Get given sesconds in hh:mm:ss format # Arguments - a_second : Seconds to convert ( trimmed ) # Example $assert(00:33:40,$hms(2020)) ### hygiene Macro Type : Function Macro Name : hygiene Arguments : ["a_hygiene?^"] Usage : $hygiene(a_hygiene?^) Description >> Toggle hygiene mode. This enables macro hygiene. - On "macro" hygiene, every newly defined runtime macro is cleared after a first level macro invocation. # Arguments - a_hygiene : Whether to enable macro hygiene mode [boolean] (trimmed) # Example $hygiene(true) $define(test=Test) % test macro is cleared and doesn't exsit $fassert($test()) ### if Macro Type : Deterred Macro Name : if Arguments : ["a_cond?^", "a_if_expr"] Usage : $if(a_cond?^,a_if_expr) Description >> Check condition and then execute an expression if the condition is true # Expansion order 1. a_cond : Expanded on time 2. a_if_expr : Only when a_cond is true # Arguments - a_cond : A condition to audit ( trimmed ) - a_if_expr : An expression to expand if the condition is true # Example $assert(I'm true,$if(true,I'm true)) ### ifdef Macro Type : Deterred Macro Name : ifdef Arguments : ["a_macro_name^", "a_if_expr"] Usage : $ifdef(a_macro_name^,a_if_expr) Description >> Execute an expression if macro is defined # Expansion order 1. a_macro_name : Expanded on time 2. a_if_expr : Only when a_macro_name is defined # Arguments - a_macro_name : A macro name to check ( trimmed ) - a_if_expr : An expression to expand if the macro is defined # Example $assert(I'm defined,$ifdef(define,I'm defined)) ### ifdefel Macro Type : Deterred Macro Name : ifdefel Arguments : ["a_macro_name^", "a_if_expr", "a_else_expr"] Usage : $ifdefel(a_macro_name^,a_if_expr,a_else_expr) Description >> Execute an expression by whether macro is defined or not # Expansion order 1. a_macro_name : Expanded on time 2. a_if_expr : Only when a_macro_name is defined 3. a_else_expr : Only when a_macro_name is NOT defined # Arguments - a_macro_name : A macro name to check ( trimmed ) - a_if_expr : An expression to expand if the macro is defined - a_else_epxr : An expression to expand if the macro is NOT defined # Example $assert(I'm defined,$ifdefel(define,I'm defined,I'm NOT defined)) $assert(I'm NOT defined,$ifdefel(defuo,I'm defined,I'm NOT defined)) ### ifelse Macro Type : Deterred Macro Name : ifelse Arguments : ["a_cond?^", "a_if_expr", "a_else_expr"] Usage : $ifelse(a_cond?^,a_if_expr,a_else_expr) Description >> Check condition and execute a different expression by the condition # Expansion order 1. a_cond : Expanded on time 2. a_if_expr : Only when a_cond is true 3. a_else_expr : Only when a_cond is false # Arguments - a_cond : A condition to audit ( trimmed ) - a_if_expr : An expression to expand if the condition is "true" - a_else_expr : An expression to expand if the condition is "false" # Example $assert(I'm true,$ifelse(true,I'm true,I'm false)) $assert(I'm false,$ifelse(false,I'm true,I'm false)) ### ifenv Macro Type : Deterred Macro Name : ifenv Arguments : ["a_env_name^", "a_if_expr"] Usage : $ifenv(a_env_name^,a_if_expr) Description >> Execute an expression if an environment variable is set # Auth : ENV # Expansion order 1. a_env_name : Expanded on time 2. a_if_expr : Only when env_name is defined # Arguments - a_env_name : An environment variable to check ( trimmed ) - a_if_expr : An expression to expand if env exists # Example $assert(I'm alive,$ifenv(HOME,I'm alive)) ### ifenvel Macro Type : Deterred Macro Name : ifenvel Arguments : ["a_env_name^", "a_if_expr", "a_else_expr"] Usage : $ifenvel(a_env_name^,a_if_expr,a_else_expr) Description >> Execute an expression by whether environment variable is set or not # Auth : ENV # Expansion order 1. a_env_name : Expanded on time 2. a_if_expr : Only when env_name is defined 3. a_else_expr : Only when env_name is NOT defined # Arguments - a_env_name : An environment variable to check ( trimmed ) - a_if_expr : An expression to expand if env exists - a_else_expr : An expression to expand if env doesn't exist # Example $assert(I'm alive,$ifenvel(HOME,I'm alive,I'm dead)) $assert(I'm dead,$ifenvel(EMOH,I'm alive,I'm dead)) ### ifque Macro Type : Deterred Macro Name : ifque Arguments : ["a_bool?^", "a_content"] Usage : $ifque(a_bool?^,a_content) Description >> If true, then queue expressions Use a que macro when macros do operations that do not return a string AND you need to make sure the operation should happen only after all string manipulation ended. Halt is queued by default. Que does not evalute inner contents and simply put expression into a queue. # Expansion order 1. a_bool : Expanded on time 2. a_expr : NEVER expanded # Arguments - a_bool : A condition [boolean] ( trimmed ) - a_expr : An expression to queue # Example $ifque(true,halt(false)) ### import Macro Type : Function Macro Name : import Arguments : ["a_file^"] Usage : $import(a_file^) Description >> Import a frozen file at runtime - Import always include the macros as non-volatile form, thus never cleared unless accessed from library # Arguments - a_file: A file name to import from [path] (trimmed) # Example $import(def.r4f) ### include Macro Type : Deterred Macro Name : include Arguments : ["a_filename^", "a_raw_mode^+?"] Usage : $include(a_filename^,a_raw_mode^+?) Description >> Include a file - Include works as bufread in first level and chunk read in nested call. - Use readin if you want to enforce bufread - If raw mode is enabled include doesn't expand any macros inside the file # NOT Deterred # AUTH : FIN # Arguments - a_filename : A file name to read ( trimmed ) - a_raw_mode : Whehter to escape the read. A default is false [boolean] ( trimmed, optional ) $include(file_path) $include(file_path, true) ### incread Macro Type : Deterred Macro Name : incread Arguments : ["a_filename^", "a_raw_mode^+?"] Usage : $incread(a_filename^,a_raw_mode^+?) Description >> Alwasy include a file as "read" - Include works as bufread in first level and chunk read in nested call. - Use incread when you need to read on first level. # NOT Deterred # AUTH : FIN # Arguments - a_filename : A file name to read ( trimmed ) - a_raw_mode : Whehter to escape the read. A default is false [boolean] ( trimmed, optional ) $incread|(file_path) $-() ### indent Macro Type : Function Macro Name : indent Arguments : ["a_indenter", "a_lines"] Usage : $indent(a_indenter,a_lines) Description >> Indent lines with indenter # Arguments - a_indenter : An expression to put before lines - a_lines : Lines to prepend indenter # Example $assert( # First # Second # Third, $indent(# ,First Second Third)) ### index Macro Type : Function Macro Name : index Arguments : ["a_index^", "a_array"] Usage : $index(a_index^,a_array) Description >> Get an indexed value from an array - A positive integer works as a normal index number - A negative integer works as an index from end ( -1 == len -1 ) # Arguments - a_index : An index to get [Signed integer] ( trimmed ) - a_array : Data source to index from # Example $assert(ef,$index(2,ab,cd,ef)) ### indexl Macro Type : Function Macro Name : indexl Arguments : ["a_index^", "a_lines"] Usage : $indexl(a_index^,a_lines) Description >> Get an indexed line from lines - A positive integer works as a normal index number - A negative integer works as an index from end ( -1 == len -1 ) # Arguments - a_index : An index to get [Signed integer] ( trimmed ) - a_liens : Lines to index from # Example $assert(line 2,$indexl(1,line 1$nl()line 2$nl())) ### input Macro Type : Function Macro Name : input Arguments : ["a_absolute?^+"] Usage : $input(a_absolute?^+) Description >> Print a current file input. # Return : Path # Arguments - a_absolute : Whether to print an input path as absolute. Default is false. [boolean] ( trimmed, optional ) # Example $assert($input(),test) $assert($input(true),/home/user/dir/test) ### isempty Macro Type : Function Macro Name : isempty Arguments : ["a_value"] Usage : $isempty(a_value) Description >> Check if a given value is empty # Return : Boolean # Arguments - a_value : Value to qualify # Example $assert(true,$isempty()) $assert(false,$isempty( )) ### istype Macro Type : Function Macro Name : istype Arguments : ["a_value^", "a_type^"] Usage : $istype(a_value^,a_type^) Description >> Check if a given value is a type # Return : Boolean # Arguments - a_value : Value to qualify ( trimmed ) - a_type : Type of qualification ["uint","int","float","bool"] ( trimmed ) # Example $assert(true,$istype( 0, uint)) $assert(false,$istype(-1, uint)) $assert(true,$istype( 0, int)) $assert(false,$istype(-0.1,uint)) $assert(true,$istype( -1, int)) $assert(false,$istype( 0.1,int)) $assert(true,$istype( -0.1,float)) $assert(true,$istype( -0, float)) $assert(true,$istype( 0, float)) $assert(true,$istype( 0, bool)) $assert(true,$istype( 1, bool)) ### iszero Macro Type : Function Macro Name : iszero Arguments : ["a_value^"] Usage : $iszero(a_value^) Description >> Check if a given value is a zero # Return : Boolean # Arguments - a_value : Value to qualify # Example $assert(true,$iszero(0)) $assert(false,$iszero(1)) ### join Macro Type : Function Macro Name : join Arguments : ["a_sep", "a_array"] Usage : $join(a_sep,a_array) Description >> Join an array into a single chunk # Arguments - a_sep : A separator used for joining - a_array : Source to array to join # Example $assert(a-b-c,$join(-,a,b,c)) ### joinl Macro Type : Function Macro Name : joinl Arguments : ["a_sep", "a_lines"] Usage : $joinl(a_sep,a_lines) Description >> Join text lines into a single line # Arguments - a_sep : A separator used for joining - a_lines : Source lines to join # Example $assert(a-b-c,$joinl(-,a b c)) ### len Macro Type : Function Macro Name : len Arguments : ["a_string"] Usage : $len(a_string) Description >> Get a length of text. This counts utf8 characters not ascii. # Return : Unsigned integer # Arguments - a_string : Text to get length from # Example $assert($len(가나다),$len(ABC)) ### let Macro Type : Function Macro Name : let Arguments : ["a_macro_name^", "a_value^"] Usage : $let(a_macro_name^,a_value^) Description >> Bind a local macro. Every local macro gets removed after a macro expansion ends # Arguments - a_macro_name : A macro name to create ( trimmed ) - a_value : A value to bind to ( trimmed ) # Example $define(let_test= $let(lc, --Bound Value-- ) $assert(1,$countl($lc())) ) $let_test() % Cannot access local macro outside the scope $fassert($lc()) ### letr Macro Type : Function Macro Name : letr Arguments : ["a_macro_name^", "a_value"] Usage : $letr(a_macro_name^,a_value) Description >> Bind a local macro with raw value. Every local macro gets removed after a macro expansion ends. # Arguments - a_macro_name : A macro name to make ( trimmed ) - a_value : A value to bind to which is not trimmed # Example $define(letr_test= $letr(lc, --Bound Value-- ) $assert(3,$countl($lc())) ) $letr_test() % Cannot access local macro outside the scope $fassert($lc()) ### lipsum Macro Type : Function Macro Name : lipsum Arguments : ["a_word_count^"] Usage : $lipsum(a_word_count^) Description >> Create placeholder text. The order of placeholder is always same. # Arguments - a_word_count : Word counts of placeholder ( trimmed ) # Example $assert(Lorem ipsum dolor,$lipsum(3)) ### listdir Macro Type : Function Macro Name : listdir Arguments : ["a_path^+", "a_absolute?^+", "a_delim+"] Usage : $listdir(a_path^+,a_absolute?^+,a_delim+) Description >> List a directory's files as csv. - A default path is a current working directory. - A defualt delimiter is comma. # Auth : FIN # Arguments - a_path : A directory path to list files (optional, trimmed) - a_absolute : Whether to print files as absolute form [boolean] (trimmed, optional) - a_delim : A delimiter to put between items (optional) # Example $assert(15,$count($listdir())) $listdir(/tmp,true) $listdir(/tmp,true,|) ### log Macro Type : Function Macro Name : log Arguments : ["a_msg"] Usage : $log(a_msg) Description >> Log a message to console # Arguments - a_msg : A message to log to console # Example $log($value_i_want_to_check^()) ### loge Macro Type : Function Macro Name : loge Arguments : ["a_msg"] Usage : $loge(a_msg) Description >> Log an error message to console - This prints error in non-breaking manner. Even in strict mode, this doesn't trigger a panic. # Arguments - a_msg : An error message to log to console # Example $loge(This should not be reached) ### logm Macro Type : Deterred Macro Name : logm Arguments : ["a_macro_name^"] Usage : $logm(a_macro_name^) Description >> Log a macro information. Either print a macro body of a local or a runtime macro. # NOT deterred # Arguments - a_macro_name : A macro name to log (trimmed) # Example $define(test=Test) $logm(test) ### lower Macro Type : Function Macro Name : lower Arguments : ["a_text"] Usage : $lower(a_text) Description >> Get lowercase english text # Arguments - a_text: Text to transform # Example $assert(abcde,$lower(AbCdE)) ### lp Macro Type : Function Macro Name : lp Arguments : [] Usage : $lp() Description >> Left parenthesis # Arguments # Example $assert((,$lp()) ### lt Macro Type : Function Macro Name : lt Arguments : ["a_lvalue", "a_rvalue"] Usage : $lt(a_lvalue,a_rvalue) Description >> Check if lvalue is less than rvalue # Return : Boolean # Arguments - a_lvalue : A left value to compare - a_rvalue : A right value to compare # Example $assert(false,$lt(c,b)) $assert(false,$lt(text,text)) ### lte Macro Type : Function Macro Name : lte Arguments : ["a_lvalue", "a_rvalue"] Usage : $lte(a_lvalue,a_rvalue) Description >> Check if lvalue is less than or equal to rvalue # Return : Boolean # Arguments - a_lvalue : A left value to compare - a_rvalue : A right value to compare # Example $assert(true,$lte(b,c)) $assert(true,$lte(text,text)) ### map Macro Type : Deterred Macro Name : map Arguments : ["a_macro_name^", "a_array"] Usage : $map(a_macro_name^,a_array) Description >> Execute macro on each array item # NOT Deterred # Arguments - a_macro_name : A macro name to execute ( trimmed ) - a_array : An array to iterate # Example $define(m,a_src=$a_src()+) $assert(a+b+c,$map(m,a,b,c)) ### mapf Macro Type : Deterred Macro Name : mapf Arguments : ["a_macro_name^", "a_file^"] Usage : $mapf(a_macro_name^,a_file^) Description >> Execute macro on each lines of a file # Note : mapf macro doesn't expand lines from a file. # Auth : FIN # NOT Deterred # Arguments - a_macro_name : A macro name to execute ( trimmed ) - a_file : A file to get lines iterator ( trimmed ) # Example $define(m,a_src=$a_src()+) $assert(a+b+c,$mapf(m,file_name.txt)) ### mapl Macro Type : Deterred Macro Name : mapl Arguments : ["a_macro_name^", "a_lines"] Usage : $mapl(a_macro_name^,a_lines) Description >> Execute macro on each line # NOT Deterred # Arguments - a_macro_name : A macro name to execute ( trimmed ) - a_lines : A lines to iterate # Example $define(m,a_src=$a_src()+) $assert(a+b+c,$mapl(m,a$nl()b$nl()c$nl())) ### max Macro Type : Function Macro Name : max Arguments : ["a_array"] Usage : $max(a_array) Description >> Get a max value from a given array # Arguments - a_array : An array to get the highest value from # Example $assert(eIsBigger,$max(aIsSmall,cIsMiddle,eIsBigger)) $assert(5,$max(1,2,3,4,5)) ### min Macro Type : Function Macro Name : min Arguments : ["a_array"] Usage : $min(a_array) Description >> Get a min value from a given array # Arguments - a_array : An array to get the lowest value from # Example $assert(aIsSmall,$min(aIsSmall,cIsMiddle,eIsBigger)) $assert(1,$min(1,2,3,4,5)) ### name Macro Type : Function Macro Name : name Arguments : ["a_path"] Usage : $name(a_path) Description >> Get a name from a given path including an extension # Return : path # Arguments - a_path : A path to get a name from # Example $assert(auto.sh,$name(/path/to/file/auto.sh)) ### nassert Macro Type : Function Macro Name : nassert Arguments : ["a_lvalue", "a_rvalue"] Usage : $nassert(a_lvalue,a_rvalue) Description >> Compare left and right values. Panics if values are equal # Arguments - a_lvalue : A left value - a_rvalue : A right value # Example $nassert(1,2) ### nl Macro Type : Function Macro Name : nl Arguments : ["a_amount+^"] Usage : $nl(a_amount+^) Description >> Print platform specific newlines. Its behaviour can be configured. - CRLF is returned on windows - LF is returned on *nix systems. # Arguments - a_amount : Amount of newlines [Unsigned integer] ( trimmed ) # Example % This may not hold true if a newline is configured by a user $assert($nl(), ) ### not Macro Type : Function Macro Name : not Arguments : ["a_boolean?^"] Usage : $not(a_boolean?^) Description >> Returns a negated value of a given boolean. Yields error when a given value is not a boolean # Return : boolean # Arguments - a_boolean : A boolean value to negate [boolean] ( trimmed ) # Example $assert(false,$not(true)) $assert(true,$not(false)) $assert(false,$not(1)) $assert(true,$not(0)) ### notat Macro Type : Function Macro Name : notat Arguments : ["a_number^", "a_type^"] Usage : $notat(a_number^,a_type^) Description >> Chagne notation of a number # Arguments - a_number : A number to change notation - a_type : A type of notation ["bin","oct","hex"] ( trimmed ) # Example $assert(10111,$notat(23,bin)) $assert(27,$notat(23,oct)) $assert(17,$notat(23,hex)) ### num Macro Type : Function Macro Name : num Arguments : ["a_text"] Usage : $num(a_text) Description >> Extract number parts from given text. If there are multiple numbers, only extract the first # Arguments - a_text : Text to extract number from # Example $assert(34,$num(34sec)) $assert(30,$num(30k/h for 3 hours)) ### ostype Macro Type : Function Macro Name : ostype Arguments : [] Usage : $ostype() Description >> Get operating system type - R4d only supports windows and *nix systems. - This return either "windows" or "unix" # Example $assert(unix,$ostype()) ### panic Macro Type : Function Macro Name : panic Arguments : ["a_msg"] Usage : $panic(a_msg) Description >> Panics manually with a message # Arguments - a_msg : A message to print as an error # Example $panic(This should not be reached) ### parent Macro Type : Function Macro Name : parent Arguments : ["a_path"] Usage : $parent(a_path) Description >> Get a parent from a given path. - NOTE : This yields an error if a path is a root and will return an empty value, but not a none value if a path is a single node. # Return : path # Arguments - a_path : A Path to extract parent from # Example $fassert($parent(/)) $assert($empty(),$parent(node)) $assert(/first/second,$parent(/first/second/last.txt)) ### path Macro Type : Function Macro Name : path Arguments : ["a_array^"] Usage : $path(a_array^) Description >> Merge given paths - This respects a platform path separator - Paths with colliding separator cannot be merged. e.g) a/ + /b cannot be merged # Return : path # Arguments - a_array : A path array to merge ( trimmed ) # Example $assert(a/b,$path(a,b)) $assert(/a/b,$path(/a,b)) $assert(a/b,$path(a/,b)) ### pause Macro Type : Function Macro Name : pause Arguments : ["a_pause?^"] Usage : $pause(a_pause?^) Description >> Pause macro expansions from the invocation. Paused processor will only expand $pause(false) - NOTE : Pause is not flow control but a processor state, thus the state will sustain for the whole processing. # Arguments - a_pause : Whether to pause or not [boolean] ( trimmed ) # Example $counter(i) $pause(true) $counter(i) $pause(false) $nassert(2,$i()) $assert(1,$i()) ### pipe Macro Type : Function Macro Name : pipe Arguments : ["a_value"] Usage : $pipe(a_value) Description >> Pipe a given value into an unnamed pipe # Arguments - a_value : A value to pipe # Example $pipe(Text) $assert(Text,$-()) ### pipeto Macro Type : Function Macro Name : pipeto Arguments : ["a_pipe_name^", "a_value"] Usage : $pipeto(a_pipe_name^,a_value) Description >> Pipe a given value to a named pipe # Arguments - a_pipe_name : A name of pipe container ( trimmed ) - a_value : A value to pipe # Example $pipeto(yum,YUM) $assert($-(yum),YUM) ### prec Macro Type : Function Macro Name : prec Arguments : ["a_number^", "a_precision^"] Usage : $prec(a_number^,a_precision^) Description >> Convert a float number with given precision # Return : Float # Arguments - a_number : A number to process ( trimmed ) - a_precision : A precision number to apply to number ( trimmed ) # Example $assert(0.30,$prec($eval(0.1 + 0.2),2)) ### que Macro Type : Deterred Macro Name : que Arguments : ["a_expr"] Usage : $que(a_expr) Description >> Que an expression. Queued expressions are expanded when the macro finishes Use a que macro when macros do operations that do not return a string AND you need to make sure the operation should happen only after all string manipulation ended. Halt is queued by default. Que does not evalute inner contents and simply put expression into a queue. # NO expansion at all # Arguments - a_expr : An expression to queue # Example $que(halt(false)) ### query Macro Type : Function Macro Name : query Arguments : ["a_query^"] Usage : $query(a_query^) Description >> Query a csv table - Syntax of the query resembles SQL - Refer cindex for detailed query syntax # Arguments - a_query : A query statement ( trimmed ) # Example $query(SELECT * FROM TABLE WHERE name == john FLAG PHD) ### readin Macro Type : Deterred Macro Name : readin Arguments : ["a_file?^", "a_raw_mode^+?"] Usage : $readin(a_file?^,a_raw_mode^+?) Description >> Read from a file as "Bufread" # Auth : FIN # NOT deterred # Arguments - a_file : A file to read from ( trimmed ) - a_raw_mode : Whehter to escape the read. A default is false [boolean] ( trimmed, optional ) # Example $readin(file.txt) ### readto Macro Type : Deterred Macro Name : readto Arguments : ["a_from_file^", "a_to_file^", "a_raw_mode?+^"] Usage : $readto(a_from_file^,a_to_file^,a_raw_mode?+^) Description >> Read from a file as bufread and paste into a file # Auth : FIN + FOUT # NOT deterred # Arguments - a_from_file : A file to read from ( trimmed ) - a_to_file : A file to paste into ( trimmed ) - a_raw_mode : Whehter to escape the read. A default is false [boolean] ( trimmed, optional ) # Example $readto(from.txt,into.txt) ### regcsv Macro Type : Function Macro Name : regcsv Arguments : ["a_table_name^", "a_data^"] Usage : $regcsv(a_table_name^,a_data^) Description >> Register a csv table - Querying can be only applied to registered table. # Arguments - a_table_name : A table name to be registered ( trimmed ) - a_data : Csv data ( trimmed ) # Example $regcsv(table1,a,b,c 1,2,3) ### regex Macro Type : Function Macro Name : regex Arguments : ["a_expr", "a_sub", "a_source"] Usage : $regex(a_expr,a_sub,a_source) Description >> Apply a regular expression substitution to a source # Arguments - a_expr : A regex expression to match - a_sub : Text to substitute as - a_source : Source text to operate on # Example $assert(Hello Rust,$regex(World,Rust,Hello World)) ### regexpr Macro Type : Function Macro Name : regexpr Arguments : ["a_name", "a_expr"] Usage : $regexpr(a_name,a_expr) Description >> Register a regular expression - NOTE : A registered name will not be able to be matched directly - Every regex operation creates regex cache, while registered expression will not be cached but saved permanently. Unregistered caches will be cleared if certain capacity reaches. # Arguments - a_name : A name of the regex expression. This is not trimmed - a_epxr : An expression to bind to # Example $regexpr(greeting,Hello World) $assert(true,$find(greeting,Hello World)) $assert(false,$find(greeting,greetings from world)) ### relay Macro Type : Function Macro Name : relay Arguments : ["a_target_type^", "a_target^"] Usage : $relay(a_target_type^,a_target^) Description >> Start relaying to a target. Relay redirects all following text to the relay target. NOTE, relay is not evaluated inside arguments. # Auth : FOUT is required for relay target "file" and "temp" # Arguments - a_target_type : A type of a relay target ["macro","file", "temp"] (trimmed) - a_target : A name of a target. Ignored in temp type ( trimmed ) # Example $relay(file,out.md)$halt() $relay(macro,container)$halt() $relay(temp)$halt() ### rename Macro Type : Function Macro Name : rename Arguments : ["a_macro_name^", "a_new_name^"] Usage : $rename(a_macro_name^,a_new_name^) Description >> Rename a macro with a new name # Arguments - a_macro_name : A macro to change name ( trimmed ) - a_new_name : A new macro name to apply ( trimmed ) # Example $define(test=Test) $rename(test,demo) $assert($demo(),Test) ### repeat Macro Type : Function Macro Name : repeat Arguments : ["a_count^", "a_source"] Usage : $repeat(a_count^,a_source) Description >> Repeat given source by given counts # Arguments - a_count : Counts of repetition [Unsigned integer] ( trimmed ) - a_source : Source text to repeat # Example $assert(R4d R4d R4d,$repeat^(3,R4d$nl())) ### repl Macro Type : Function Macro Name : repl Arguments : ["a_macro_name^", "a_new_value"] Usage : $repl(a_macro_name^,a_new_value) Description >> Replace a macro's contents with new values # Arguments - a_macro_name : A macro name to replace ( trimmed ) - a_new_value : A new value to put # Example $define(demo=Demo) $assert(Demo,$demo()) $repl(demo,DOMO) $assert(DOMO,$demo()) ### require Macro Type : Function Macro Name : require Arguments : ["a_permissions^"] Usage : $require(a_permissions^) Description >> Require permissions # Arguments - a_permissions : A permission array to require (trimmed) [ "fin", "fout", "cmd", "env" ] # Example $require(fin,fout) ### rev Macro Type : Function Macro Name : rev Arguments : ["a_array"] Usage : $rev(a_array) Description >> Reverse order of an array # Arguments - a_array : Array to reverse # Example $assert(3,2,1,$rev(1,2,3)) ### rp Macro Type : Function Macro Name : rp Arguments : [] Usage : $rp() Description >> right parenthesis # Arguments # Example $assert(),$rp()) ### scut Macro Type : Function Macro Name : scut Arguments : ["a_index", "a_text"] Usage : $scut(a_index,a_text) Description >> Split text by whitespaces and cut from splitted array # Arguments - a_index : An index to cut out - a_text : Text to split # Example $assert(b,$scut(-2,a b c)) ### sep Macro Type : Function Macro Name : sep Arguments : ["a_content"] Usage : $sep(a_content) Description >> Separate content # Arguments - a_content : Content to separate # Example $assert(4,$countl($sep( 1 2 ))) ### slice Macro Type : Function Macro Name : slice Arguments : ["a_min^", "a_max^", "a_array"] Usage : $slice(a_min^,a_max^,a_array) Description >> Get a slice from an aray # Arguments - a_min : A start index ( trimmed ) - a_max : A end index ( trimmed ) - a_array : An array to process # Example $assert(2,3,$slice(1,2,1,2,3,4,5,6)) ### sort Macro Type : Function Macro Name : sort Arguments : ["a_sort_type^", "a_array"] Usage : $sort(a_sort_type^,a_array) Description >> Sort an array # Arguments - a_sort_type : A sort type ["asec","desc"] (trimmed) - a_array : An array to sort # Example $assert(0,1,3,4,6,7,9,$enl() $sort(asec,3,6,7,4,1,9,0)) ### sortl Macro Type : Function Macro Name : sortl Arguments : ["a_sort_type^", "a_lines"] Usage : $sortl(a_sort_type^,a_lines) Description >> Sort lines # Arguments - a_sort_type : A sort type ["asec","desc"] (trimmed) - a_lines : Lines to sort # Example $assert(f$nl()e$nl()d$nl()c,$sortl(desc,f e d c)) ### source Macro Type : Function Macro Name : source Arguments : ["a_file^"] Usage : $source(a_file^) Description >> Source an env file. The sourced file is eagerly expanded (As if it was static defined) Syntax of source-able file is same with .env file e.g) demo=DEMO number=$eval(1+2) # Arguments - a_file : A file to source ( trimmed ) # Example $source(def.env) ### space Macro Type : Function Macro Name : space Arguments : ["a_amount?^"] Usage : $space(a_amount?^) Description >> Print spaces # Arguments - a_amount : Amount of spaces [Unsigned integer] ( trimmed ) # Example $assert( ,$space(4)) ### split Macro Type : Function Macro Name : split Arguments : ["a_sep", "a_text"] Usage : $split(a_sep,a_text) Description >> Split text into an array # Arguments - a_sep : A separator string - a_text : Text to split # Example $assert(a,b,c,$split(/,a/b/c)) ### spread Macro Type : Deterred Macro Name : spread Arguments : ["a_macro_name^", "a_csv_value^"] Usage : $spread(a_macro_name^,a_csv_value^) Description >> Execute a macro multiple times with given data chunk. Each csv line represents an argument for a macro # NOT Deterred # Arguments - a_macro_name : A macro name to execute ( trimmed ) - a_csv_value : Arguments table ( trimmed ) # Example $assert=( text****** ***text*** ******text, $spread=( align, left,10,*,text center,10,*,text right,10,*,text ) ) ### squash Macro Type : Function Macro Name : squash Arguments : ["a_text"] Usage : $squash(a_text) Description >> Squash text by trimming all empty newlines # Arguments - a_text : Text to squash # Example $assert(a$nl()b,$squash( a b )) ### ssplit Macro Type : Function Macro Name : ssplit Arguments : ["a_text^"] Usage : $ssplit(a_text^) Description >> Split text with space separator into an array - This macro split text by one or more blank characters ( space, tab, newline ) # Arguments - a_text : Text to split ( trimmed ) # Example $assert(6,$count($ssplit(I have some spaces in between))) ### static Macro Type : Function Macro Name : static Arguments : ["a_macro_name^", "a_expr^"] Usage : $static(a_macro_name^,a_expr^) Description >> Create a static macro. A static macro is eagerly expanded unlike define # Arguments - a_macro_name : A macro to create ( trimmed ) - a_expr : An expression to bind to ( trimmed ) # Example $define(ct=0) $define(ddf=$ct()) $static(stt,$ct()) $counter(ct) $counter(ct) $assert(2,$ddf()) $assert(0,$stt()) ### staticr Macro Type : Function Macro Name : staticr Arguments : ["a_macro_name^", "a_value"] Usage : $staticr(a_macro_name^,a_value) Description >> Create a static macro with raw value. A static macro is eagerly expanded unlike define # Arguments - a_macro_name : A macro to create ( trimmed ) - a_expr : An expression to bind to which is not trimmed # Example $define(ct=0) $define(ddf=$ct()) $staticr(stt,$ct() ) $counter(ct) $counter(ct) $assert(2,$ddf()) $assert(0 ,$stt()) ### strict Macro Type : Function Macro Name : strict Arguments : ["a_mode^"] Usage : $strict(a_mode^) Description >> Check strict mode # Arguments - a_mode : A mode to require. Empty means strict ( trimmed ) [ "lenient", "purge" ] # Example $strict() $strict(lenient) ### strip Macro Type : Function Macro Name : strip Arguments : ["a_count^", "a_content"] Usage : $strip(a_count^,a_content) Description >> Strip surroundings from text # Arguments - a_count : Count of characters to strip ( trimmed ) - a_content : Content to strip # Example $assert(Hello World,$strip(2,' Hello World ')) ### stripf Macro Type : Function Macro Name : stripf Arguments : ["a_count^", "a_content"] Usage : $stripf(a_count^,a_content) Description >> Strip from front # Arguments - a_count : Count of characters to strip ( trimmed ) - a_content : Content to strip # Example $assert(List item,$stripf(2,- List item)) ### stripr Macro Type : Function Macro Name : stripr Arguments : ["a_count^", "a_content"] Usage : $stripr(a_count^,a_content) Description >> Strip from rear # Arguments - a_count : Count of characters to strip ( trimmed ) - a_content : Content to strip # Example $assert(Hmp,$stripr(2,Hmp::)) ### sub Macro Type : Function Macro Name : sub Arguments : ["a_start_index^", "a_end_index^", "a_source"] Usage : $sub(a_start_index^,a_end_index^,a_source) Description >> Get a substring with indices. - Out of range index is an error - A substring is calculated as char iterator not a byte iterator - this operation is technically same with [start_index..end_index] # Arguments - a_start_index : A start substring index [Unsigned integer] (trimmed) - a_end_index : A end substring index [Unsigned integer] (trimmed) - a_source : Source text get to a substring from # Example $assert(def,$sub(3,5,abcdef)) ### surr Macro Type : Function Macro Name : surr Arguments : ["a_start_pair", "a_end_pair", "a_content"] Usage : $surr(a_start_pair,a_end_pair,a_content) Description >> Surround given contents with a given pair # Arguments - a_start_pair : A start pair - a_end_pair : A end pair - a_content : Text to surround with # Example $assert(