5.5.17 ‘@N’: Turn on N mode ¶
This command must appear before the code part. Generally, this
means immediately before ‘@a’. Do not use this command in
limbo; use ‘@Lv’ instead.
The N mode invokes language-independent behavior within the scope of
a particular language. The scoping rules are the same as for language
changes; i.e., using ‘@N’ within a given section produces
language-independent behavior for that section and for any modules first
referenced in that section.
Fundamentally, language-independent behavior essentially means a literal
transcription of the input to the output. For example, it inhibits
blank compression by FTANGLE and tells FWEAVE to turn off
“pretty-printing” (instead, the output is printed in typewriter type
within a ‘\begin{verbatim}...\end{verbatim}’ environment).
There are some subtleties with this mode (not to mention the likelihood
of bugs):
- FWEB macros and built-in
functions will normally be expanded even in the N mode. To inhibit
expansion of a particular identifier, place ‘@!’ before the
identifier. For example,
expands to ‘A = 1’.
- Blank lines are significant. The N mode is ended by the appearance of
the ‘@*’ or ‘@ ’ denoting the start of the next section. If
that were preceded by one or more blank lines, those would show up in
both the tangled and woven output. They might or might not be
significant in the tangled output, but they almost certainly will look
ugly in the woven output. To avoid this, use the command ‘@%%’,
which deletes the remainder of the current line and all immediately
following empty lines. For example,
@
@N
@a
x;@%%
@ Next section.
- If the N mode is invoked from a compiler-like language such as FORTRAN,
cross-referencing of variables is done as usual. However, if the
language is VERBATIM (which turns on the N mode automatically), no
cross-referencing is done. (Identifiers are still recognized according
to FWEB’s rules. Those rules as currently implemented may be
essentially meaningless for some languages; in the future, provision may
be made for generalizing these rules by the user.) To force an
identifier to be placed into the Index, precede it by ‘@+’.
- A module name must be within the scope of an ‘@N’ the first time
the name is seen, if it is ever to be within such scope. Thus, the
following does not work properly:
@ Consider the module @<Test@>. (Not yet within scope of \.{@N}.)
@N
@a
x;
@<Test@>@;
y;
What happens is that the N mode is not restored after the code-part use
of ‘@<Test@>’. This is a bug. There are very tricky design
issues to be dealt with here.