yodlverbinsert - Generate verb-sections from parts of a file
yodlverbinsert [OPTIONS] [marker] file
Verbinsert is a simple C++ support program that is
used for generating verb()-sections in Yodl files using
sections of existing files. The files from which sections are included are
usually C or Cpp source files, accepting either // or
/*-style comment. See the EXAMPLES section for
illustrations.
Verbinsert offers the possibility to indent both the
initial verb-statement and the inserted file contents. Furthermore,
an additional empty line may be inserted before the first line that is
actually inserted.
Blank lines at the beginning and end of files are ignored.
- o
- marker
The argument marker must start in file’s first column
en must either start as a standard C or C++ comment:
// or /* must be used. Following that, the remainder of the
argument is used as a label, e.g., //label, /*label*/.
Except for the first two characters and their locations, and the last two
characters of a C-style marker, no special restrictions are imposed
upon the label-names. A labeled section ends at the next //= (for
labels starting with //) or at the next /**/ (for labels
starting with /*). Like the markers, the end-markers must also
start in the first columns of lines.
- Alternatively, pairs of //+label, or /*+label*/ can be used.
For such markers, copying starts at the first line following the first
occurrence of the label, and ends when the label is encountered again.
When these markers are used any additionally encountered marker-line is
simply ignored, and not written to the output stream. This allows labeled
sections to be nested.
- o
- file
The argument file must be an existing file.
Verbinsert writes its selected section to its standard
output stream.
When files contain identical marker sections then the contents of
each of these marker sections is included in the generated
verb-section. This allows the inclusion of non-consecutive lines of
source files in a verb section.
The default values of options are listed with each of the options
between square brackets. The defaults were chosen so that
yodlverbinsert performs the behavior of an earlier version of this
program, which was not distributed with Yodl.
- o
- -a
Process all lines of file (except initial and trailing blank lines).
The argument marker must not be specified.
- o
- -A
Same as the -a option, but ignoring all lines that can be considered
yodlverbinsert (end) marker-lines.
- o
- -k
Keep the newlines after
and before
. These newlines result in extra empty lines before the first and after the
last source code lines. Starting with version 4.02.00 these lines are
removed by default.
- o
- -n
Immediately following the indentation: lines are prefixed by numbers,
occupying 2 columns, followed by a colon and a blank.
- o
- -N
Do not write a newline immediately following verb-statement’s
open-parenthesis. By default it is written, causing an additional line to
be inserted before the first line that’s actually inserted from a
file.
- o
- -s nSpaces [0]
start each line that is written into the verb-section with
nSpaces additional blanks.
- o
- -S nSpaces [8]
prefix the verb of the verb-section by nSpaces
additional blanks.
- o
- -t nTabs [0]
start each line that is written into the verb-section with
nTabs additional tab characters. If both -s and -t
are specified, the tabs are inserted first.
- o
- -T nTabs [0]
prefix the verb of the verb-section by nTabs additional
tab characters. If both -S and -T are specified, the tabs
are inserted first.
Assume the file demo contains the following text:
preceding text
//+nest
//one
one 1
//=
/*two*/
two
/**/
//+nest
trailing text
Then the following commands write the shown output to the
program’s standard output:
- o
- yodlverbinsert //one demo
verb(
one 1
)
- o
- yodlverbinsert -N //one demo
verb(one 1
)
- o
- yodlverbinsert -n -s4 ’/*two*/’ demo
verb(
1: two
)
- o
- yodlverbinsert -n //+nest’ demo
verb(
1: one 1
2:
3:
4:
5: two
)
Frank B. Brokken (f.b.brokken@rug.nl),