% 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: $$ \begin{prooftree} \trans {\pgm}{\ip}{(\push{\texttt{"}\escape{s}\texttt{"}}{\stk'}, \str) } {\ip'}{\op}{\st} \justifies \trans {\StmQuotify:\pgm}{\ip}{(\stk,\str)} {\ip'}{\op}{\st} \using{\rquotifyns} \qquad \text{met $\pop{\stk} = (s, stk')$.} \end{prooftree} $$ $$ \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} $$