macro-processor
This is simple macro-processor can be used for simple text replacing, but
also there can be complex expression computed before string replacing.
As an additional ability it has amount of optional functions.(Some of functions are planned only)
In common way:
(Also it's good to leave space in the end of the line)
macro1 -> expression
macron -> expression_n
There is kind of generative expressions:
macro -> hello, {4, world }
You will get hello and world repeated 4 times.
Also you can pass value of macro into the another one:
macro1 -> some expression and $macron
Also macron will be computed and passed to its place.
So, but if you need to write macro name, but don't use this macro?
embrace it with ':
'macro'
and this macro won't be computed.
But if you need to pass result of macro into '?
Not problem. Type something like this:
''macro''
So you get 'macro_result'
Now i want to show functional macro:
In common way it looks so:
macro# -> some word is #0 and you know what is #1
In file write:macro[arg0, arg1]
Also when you use argument you must split with space
And every macro must be ended with space!
There are bunch of functions and you can apply them to files:
All of the starts with -
List:
- -oo means option only. So you can use optional functions only
- -ea means erase all. Also you need to pass = after and value to erase
Example:-ea=rep - -s means save file copy before any change.
- -c means count all elements in file and print where it is.
- -ra means replace all old strings to the new ones
Example:-ra=old:new
Macros will be replaced with expression.
To run processor you pass files and macro file with .ko extension as argv:
python kobold.py source1 source2 source_n macroses.ko
- - made basical macro-processor
- - add an support of regular expression for macro expressions