| 1 |
|
| 2 |
<HTML> |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
<HEAD> |
| 29 |
<TITLE>3.5 Inserting Arbitrary Characters into the Text</TITLE> |
| 30 |
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE> |
| 31 |
</HEAD> |
| 32 |
<BODY BACKGROUND="binary/background.gif" |
| 33 |
BGCOLOR="#FFFFFF" |
| 34 |
TEXT="#000000" |
| 35 |
VLINK="#660000" |
| 36 |
LINK="#FF0000" |
| 37 |
ALINK="#CC0000"> |
| 38 |
|
| 39 |
<TABLE WIDTH="490"> |
| 40 |
<TR> |
| 41 |
<TD WIDTH="130" VALIGN="top"> |
| 42 |
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR> |
| 43 |
|
| 44 |
<FONT SIZE="2"> |
| 45 |
<BR> |
| 46 |
|
| 47 |
<A HREF="http://www.ross.net/" |
| 48 |
TARGET="rosshome" |
| 49 |
onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 50 |
> |
| 51 |
<IMG SRC="binary/rossnet_logo.gif" |
| 52 |
WIDTH="64" HEIGHT="32" |
| 53 |
BORDER="0" ALT="RossNet" |
| 54 |
HSPACE="0" VSPACE="1"></A><BR> |
| 55 |
<BR> |
| 56 |
|
| 57 |
<A HREF="../index.shtml" |
| 58 |
TARGET="funnelweb" |
| 59 |
onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 60 |
> |
| 61 |
<IMG SRC="binary/linklogo.gif" |
| 62 |
WIDTH="64" HEIGHT="32" |
| 63 |
BORDER="0" ALT="FunnelWeb" |
| 64 |
HSPACE="0" VSPACE="1"></A><BR> |
| 65 |
<BR> |
| 66 |
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000"> |
| 67 |
<A HREF="../tutorial/index.html" |
| 68 |
TARGET="funnelwebtutorial" |
| 69 |
onClick="window.open('','funnelwebtutorial','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 70 |
><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR> |
| 71 |
<BR> |
| 72 |
<A HREF="../developer/index.html" |
| 73 |
TARGET="funnelwebdeveloper" |
| 74 |
onClick="window.open('','funnelwebdeveloper','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 75 |
><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR> |
| 76 |
<BR> |
| 77 |
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR> |
| 78 |
<A HREF="intro.html"><FONT COLOR="#FFFFFF">1 Introduction</FONT></A><BR> |
| 79 |
<A HREF="interface.html"><FONT COLOR="#FFFFFF">2 Interface</FONT></A><BR> |
| 80 |
<A HREF="scanner.html"><FONT COLOR="#FFFFFF">3 Scanner</FONT></A><BR> |
| 81 |
<A HREF="parser.html"><FONT COLOR="#FFFFFF">4 Parser</FONT></A><BR> |
| 82 |
<A HREF="analyser.html"><FONT COLOR="#FFFFFF">5 Analyser</FONT></A><BR> |
| 83 |
<A HREF="tangle.html"><FONT COLOR="#FFFFFF">6 Tangle</FONT></A><BR> |
| 84 |
<A HREF="weave.html"><FONT COLOR="#FFFFFF">7 Weave</FONT></A><BR> |
| 85 |
<A HREF="shell.html"><FONT COLOR="#FFFFFF">8 Shell</FONT></A><BR> |
| 86 |
<A HREF="commands.html"><FONT COLOR="#FFFFFF">9 Commands</FONT></A><BR> |
| 87 |
<A HREF="glossary.html"><FONT COLOR="#FFFFFF">10 Glossary</FONT></A><BR> |
| 88 |
<A HREF="references.html"><FONT COLOR="#FFFFFF">11 References</FONT></A><BR> |
| 89 |
|
| 90 |
<BR> |
| 91 |
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR> |
| 92 |
</FONT> |
| 93 |
</TD></TR></TABLE> |
| 94 |
|
| 95 |
|
| 96 |
</TD> |
| 97 |
<TD WIDTH="360" VALIGN="top"> |
| 98 |
<FONT SIZE="3"> |
| 99 |
|
| 100 |
|
| 101 |
<A HREF="index.html"><IMG SRC="binary/title.gif" |
| 102 |
WIDTH="316" HEIGHT="24" |
| 103 |
BORDER="0" ALT="FunnelWeb Reference Manual" |
| 104 |
HSPACE="0" VSPACE="0"></A> |
| 105 |
<P><FONT SIZE="5">3.5 Inserting Arbitrary Characters into the Text</FONT><BR> |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
<P>While FunnelWeb does not tolerate unprintable |
| 111 |
characters in the input file (except for the end of line |
| 112 |
character), it does allow the user to specify that |
| 113 |
unprintable characters appear in the product file. The |
| 114 |
<SAMP>@^</SAMP> sequence inserts a single |
| 115 |
character of the user's choosing into the text. The |
| 116 |
character can be specified by giving its ASCII number in one |
| 117 |
of four bases: binary, octal, decimal, and hexadecimal. Here |
| 118 |
is the syntax: |
| 119 |
|
| 120 |
<P> |
| 121 |
<PRE> |
| 122 |
control_sequence = "@^" char_spec |
| 123 |
char_spec = binary | octal | |
| 124 |
decimal | hexadecimal |
| 125 |
binary = ("b" | "B") |
| 126 |
"(" {binary_digit}8 ")" |
| 127 |
octal = ("o" | "O" | "q" | "Q") |
| 128 |
"(" {octal_digit}3 ")" |
| 129 |
decimal = ("d" | "D") |
| 130 |
"(" {decimal_digit}3 ")" |
| 131 |
hexadecimal = ("h" | "H" | "x" | "X") |
| 132 |
"(" {hex_digit}2 ")" |
| 133 |
binary_digit = "0" | "1" |
| 134 |
octal_digit = binary_digit | "2" | "3" | |
| 135 |
"4" | "5" | "6" | "7" |
| 136 |
decimal_digit = octal_digit | "8" | "9" |
| 137 |
hex_digit = decimal_digit | |
| 138 |
"A" | "B" | "C" | "D" | "E" | "F" | |
| 139 |
"a" | "b" | "c" | "d" | "e" | "f" |
| 140 |
</PRE> |
| 141 |
|
| 142 |
<P>Example: |
| 143 |
|
| 144 |
<PRE> |
| 145 |
@! Unix Make requires that productions |
| 146 |
@! commence with tab characters. |
| 147 |
@^D(009)prog.o <- prog.c |
| 148 |
</PRE> |
| 149 |
|
| 150 |
<P>Note that the decimal "<TT>9</TT>" is expressed with |
| 151 |
leading zeros as "<TT>009</TT>". FunnelWeb requires a fixed |
| 152 |
number of digits for each base. Eight digits for base two, |
| 153 |
three digits for base ten, three digits for base eight and |
| 154 |
two digits for base sixteen. |
| 155 |
|
| 156 |
<P>FunnelWeb treats the character resulting from a |
| 157 |
<SAMP>@^</SAMP> sequence as ordinary text in every |
| 158 |
sense. If your input file contains many instances of a |
| 159 |
particular control character, you can package it up in a |
| 160 |
macro like any other text. In particular, quick names can be |
| 161 |
used to great effect: |
| 162 |
|
| 163 |
<P> |
| 164 |
<PRE> |
| 165 |
@! Unix "Make" requires that productions |
| 166 |
@! commence with tab characters. |
| 167 |
@! So we define a macro with a quick name |
| 168 |
@! as a tab character. |
| 169 |
$@#T@{@^D(009)@} |
| 170 |
@! And use it in our productions. |
| 171 |
@#Tprog.o <- prog.c |
| 172 |
@#Ta.out <- prog.o |
| 173 |
</PRE> |
| 174 |
|
| 175 |
<P>Warning: If you insert a Unix |
| 176 |
newline character (decimal 10) into the text, FunnelWeb will |
| 177 |
treat this as an end of line sequence regardless of what the |
| 178 |
character sequence for end of line is on the machine upon |
| 179 |
which it is running. Unix EOL is FunnelWeb's internal |
| 180 |
representation for end of line. Thus, in the current version |
| 181 |
of FunnelWeb, inserting character 10 into the text is |
| 182 |
impossible unless this also happens to be the character used |
| 183 |
by the operating system to mark the end of line. |
| 184 |
|
| 185 |
|
| 186 |
<P> |
| 187 |
<TABLE WIDTH="100%"> |
| 188 |
<TR> |
| 189 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="scanner_special_ins.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 190 |
<TD ALIGN="center" VALIGN="bottom"><A HREF="scanner.html"><IMG SRC="binary/fw_up.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Up"></A></TD> |
| 191 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="scanner_comments.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 192 |
</TR> |
| 193 |
</TABLE> |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
<P> |
| 198 |
<HR> |
| 199 |
<FONT SIZE="2"> |
| 200 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 201 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 202 |
</FONT> |
| 203 |
|
| 204 |
</FONT> |
| 205 |
</TD> |
| 206 |
</TR> |
| 207 |
</TABLE> |
| 208 |
|
| 209 |
|
| 210 |
</FONT> |
| 211 |
</BODY> |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
</HTML> |