Summary: A very simple macro processor
Author: Göran Krampe
Owner: Göran Krampe (gk)
Co-maintainers: <None>
PackageInfo name: SiimpleMacro
RSS feed:


MacroProcessor is a preprocessor that can process a String and given a startString and an endString it will call a given model (or a pluggable block) to expand the contents found between those markers. The content between one such pair of start/end markers is called a macro. The result returned from the model/block is called an expansion.

MacroProcessor can either do one level expansion (not further expanding macros possibly produced by the expansions) or do deep expansion which means it will immediately try to further process produced expansions. It can also be configured to not recurse, which means it will not process the macro itself before expanding it. If recursing it will do left to right, inner first expansion.

Trivial ASP/JSP-ish expansion:

| proc |
proc := MacroProcessor block: [:x | (Compiler evaluate: x) asString] between: '<%' and: '%>'.
proc process: 'This code: 3+4 evaluates to: <% 3+4 %>'