ocr-tools/tools/yapp.doc

49 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

2019-05-15 16:55:03 +02:00
YAPP is a simple macro preprocessor designed to do minor tweaking to
another program's inputs.
In its input, anything of the form ${foo} is expanded with the variable
named foo. It is an error if ${foo} is not defined.
If you need to escape a dollar sign for some reason, the variable
with the empty string name , ${}, has the value "$".
The result of macro expansion is *not* re-expanded. Expansion is done only
when definitions are made.
After variable expansion, lines are checked to see if they are control lines.
Control lines begin with ## (after optional leading whitespace) All such lines are deleted and
do not appear in the output. ### is a comment. Other options
are:
##set variable=value
value may have one of the following forms:
token: Trailing whitespace is stripped. The token may not contain
any whitespace. Use quotes if it's complicated.
"string": The string may have embedded quotes, and whitespace after
the closing quote.
<<"DELIM": This is a here-document, and the value is all of the following
lines up until, but not including, the newline that precedes a line
that consists soley of DELIM, for any DELIM string.
The Delim must be in quotes. You have two options:
"DELIM": Expand macros in the body of the here-document.
'DELIM': Do not expand macros in the here-document.
##include "filename": Insert the named file in place of the current line.
##if num == num
##if num != num
##if num < num
##if num > num
##if num <= num
##if num >= num
##if token eq token
##if token ne token
##ifdef symbol
##ifndef symbol
##else
##endif
You can figure this one out. Macros in between are expanded as usual
(so the ##else or ##endif may be in a macro expansion), but the result
is ignored. String comparison is allowed only between simple words.
#ifdef symbol is true if ${symbol} is defined.