--- a/ProgTutorial/Recipes/Antiquotes.thy Fri May 17 07:29:51 2019 +0200
+++ b/ProgTutorial/Recipes/Antiquotes.thy Fri May 17 10:38:01 2019 +0200
@@ -31,11 +31,10 @@
We first describe the antiquotation \<open>ML_checked\<close> with the syntax:
- @{text [display] "@{ML_checked \"a_piece_of_code\"}"}
+ @{text [display] \<open>@{ML_checked "a_piece_of_code"}\<close>}
The code is checked by sending the ML-expression @{text [quotes] "val _ =
- a_piece_of_code"} to the ML-compiler (i.e.~the function @{ML
- "ML_Context.eval_source_in"} in Line 7 below). The complete code of the
+ a_piece_of_code"} to the ML-compiler (i.e.~the function @{ML \<open>ML_Context.eval_source_in\<close>} in Line 7 below). The complete code of the
document antiquotation is as follows:
\<close>
@@ -58,26 +57,26 @@
text \<open>
- The parser @{ML "(Scan.lift Args.name)"} in Line 7 parses a string, in this
+ The parser @{ML \<open>(Scan.lift Args.name)\<close>} in Line 7 parses a string, in this
case the code, and then calls the function @{ML output_ml}. As mentioned
before, the parsed code is sent to the ML-compiler in Line 4 using the
function @{ML ml_val}, which constructs the appropriate ML-expression, and
- using @{ML "eval_in" in ML_Context}, which calls the compiler. If the code is
- ``approved'' by the compiler, then the output function @{ML "output" in
+ using @{ML \<open>eval_in\<close> in ML_Context}, which calls the compiler. If the code is
+ ``approved'' by the compiler, then the output function @{ML \<open>output\<close> in
Document_Antiquotation} in the next line pretty prints the code. This function expects
that the code is a list of (pretty)strings where each string correspond to a
- line in the output. Therefore the use of @{ML "(space_explode \"\\n\" txt)"
+ line in the output. Therefore the use of @{ML \<open>(space_explode "\\n" txt)\<close>
for txt} which produces such a list according to linebreaks. There are a
number of options for antiquotations that are observed by the function
- @{ML "output" in Document_Antiquotation} when printing the code (including \<open>[display]\<close>
- and \<open>[quotes]\<close>). The function @{ML "antiquotation_raw" in Thy_Output} in
+ @{ML \<open>output\<close> in Document_Antiquotation} when printing the code (including \<open>[display]\<close>
+ and \<open>[quotes]\<close>). The function @{ML \<open>antiquotation_raw\<close> in Thy_Output} in
Line 7 sets up the new document antiquotation.
\begin{readmore}
For more information about options of document antiquotations see \rsccite{sec:antiq}).
\end{readmore}
- Since we used the argument @{ML "Position.none"}, the compiler cannot give specific
+ Since we used the argument @{ML \<open>Position.none\<close>}, the compiler cannot give specific
information about the line number, in case an error is detected. We
can improve the code above slightly by writing
\<close>
@@ -116,7 +115,7 @@
going to implement the document antiquotation:
- @{text [display] "@{ML_resp \"a_piece_of_code\" \"a_pattern\"}"}
+ @{text [display] \<open>@{ML_resp "a_piece_of_code" "a_pattern"}\<close>}
To add some convenience and also to deal with large outputs, the user can
give a partial specification by using ellipses. For example \<open>(\<dots>, \<dots>)\<close>
@@ -193,7 +192,7 @@
the output (Lines 4 to 7) and the parser in the setup (Line 11). Now
you can write
- @{text [display] "@{ML_resp [display] \"true andalso false\" \"false\"}"}
+ @{text [display] \<open>@{ML_resp [display] "true andalso false" "false"}\<close>}
to obtain
@@ -201,7 +200,7 @@
or
- @{text [display] "@{ML_resp [display] \"let val i = 3 in (i * i, \"foo\") end\" \"(9, \<dots>)\"}"}
+ @{text [display] \<open>@{ML_resp [display] "let val i = 3 in (i * i, "foo") end" "(9, \<dots>)"}\<close>}
to obtain