Skip to content
Defines a sort of macro like language that can run any language in a text file and output the expanded result.
Python Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.gitignore
README
expander.py

README

Expander lets one run code in other code by allowing one to define functions
that are expanded out by executing them and putting their results back in the
file. The prupose is that given a file or directory, we can expand "macros"
using a given language.

For example:

Macro definition ("hello" is the name, and "python" is the language):
??defm:hello:python(arg1, arg2){{
print "puts 'Hello, %s!!!' \n%s" % (arg1, arg2)
}}

Macro call (eg, in ruby code):
??hello??'Joe'??'puts "Why, dude?"'??

Result:
puts 'Hello, Joe!!!'
puts "Why, dude?"

To call:
python expander.py [FILE|DIRECTORY]

If a file is passed in, the expanded output is printed to stdout. If a
directory is passed in, all files matching *.exp.* will be expanded into
*.* (the '.exp.' being removed).
You can’t perform that action at this time.