RossNet

FunnelWeb

Tutorial

Developer

Reference
1 Introduction
2 Interface
3 Scanner
4 Parser
5 Analyser
6 Tangle
7 Weave
8 Shell
9 Commands
10 Glossary
11 References

SEARCH
FunnelWeb Reference Manual

3.12 Pragma: Indentation

When FunnelWeb expands a macro, it can do so in two ways. First it can treat the text it is processing as a one-dimensional stream of text, and merely insert the body of the macro in place of the macro call. Second, it can treat the text of the macro as a two dimensional object and indent each line of the macro body by the amount that the macro call itself was indented. Consider the following macros.

@$@<Loop Structure@>@{@-
i=1;
while (i<=N)
   @<Loop body@>
endwhile
@}

@$@<Loop body@>@{@-
a[i]:=0;
i:=i+1;@}

Under the regime of no indentation the loop structure macro expands to:

i=1;
while (i<=N)
   a[i]:=0;
i:=i+1;
endwhile

Under the regime of blank indentation the loop structure macro expands to:

i=1;
while (i<=N)
   a[i]:=0;
   i:=i+1;
endwhile

The indentation pragma determines which of these two regimes will be used to expand the macros when constructing the product files. The syntax of the pragma is:

pragma_ident = ps "indentation" s "=" s
               ("blank" | "none")

Its two forms look like this:

@p indentation = blank
@p indentation = none

In the current version of FunnelWeb, the indentation regime is an attribute that is attached to an entire run of Tangle; it is not possible to bind it to particular product files or to particular macros. As a result, it doesn't matter where indentation pragmas occur in the input file or how many there are so long as they are all the same. By default FunnelWeb uses blank indentation.

Prev Up Next


Webmaster    Copyright © Ross N. Williams 1992,1999. All rights reserved.