blob: 27c34a3221511ae1dc5be8b549f3c894545904e2 (
plain) (
blame)
1
2
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
|
% vim: set spelllang=nl:
\subsection{\texttt{Quotify}}
\label{sec:rules:quotify}
\begin{quote}
q - "Quotifies" the string on top of the stack, so that it can be placed into
a Smurf program as a literal string, eg \texttt{Arthur "two-sheds" Jackson}
becomes \texttt{"Arthur $\backslash$"two-sheds$\backslash$" Jackson"}.
\end{quote}
Er worden aanhalingstekens om de string bovenop de stack gezet. Als er in de
oorspronkelijke string aanhalingstekens, backslashes of LF-karakters staan, dan
wordt hier een \verb$\$ voor geplaatst. Hiervoor gebruiken we de hulpfunctie
$\escapeop$.
Dit geeft de volgende regel:
\therquotifyns%
$$
\escape{c~s} =
\begin{cases}
\texttt{\textbackslash}~c~\escape{s} & \text{als
$c\in\{\texttt{"},\texttt{\textbackslash},\text{het LF-karakter}\}$} \\
c~\escape{s} & \text{anderszins}
\end{cases}
$$
|