|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jatha.Macro
This is the base class for all macros.
Field Summary | |
protected static MacroUtil |
util
Contains helper functions for macros. |
Constructor Summary | |
Macro()
|
Method Summary | |
void |
expand(java.lang.String[] args,
java.io.Writer out,
Expander expander)
This is the more convenient version of expand. |
void |
expand(java.lang.String arg,
java.io.Writer out,
Expander expander)
Most macros use the other version of expand. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static MacroUtil util
Constructor Detail |
public Macro()
Method Detail |
public void expand(java.lang.String arg, java.io.Writer out, Expander expander) throws java.io.IOException
This version of expand needs to do its own argument processing.
For example, if your macro takes two arguments separated by a comma like
@foo(a, b)
, this version of expand will be passed "a, b".
The other version of expand would get {"a", "b"}. If your Macro is like
most macros, you should override the other version and pretend this one
doesn't exist.
The default implementation of this method calls
MacroUtil.splitString(arg, ',', true, true, true, true)
and passes the result to the other version of expand. In English,
that means that it breaks the raw argument string into a bunch of
separate arguments, separated by commas. Each argument has any leading
or trailing whitespace removed, and commas that are inside parenthesis
or double-quotes are not split into separate arguments.
arg
- The raw, unsplit argument to the macro.public void expand(java.lang.String[] args, java.io.Writer out, Expander expander) throws java.io.IOException
@foo(a(b,c), x"y,z")
becomes {"a(b,c)", "x\"y,z\""}. Note that in that example, there are
only two arguments, not four.
If you want to parse the arguments yourself, you should use the other version of expand.
The default implementation throws an error, complaining that expand() hasn't been implemented.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |