src/Doc/Isar_Ref/Outer_Syntax.thy
changeset 58725 9402a7f15ed5
parent 58724 e5f809f52f26
child 58842 22b87ab47d3b
equal deleted inserted replaced
58724:e5f809f52f26 58725:9402a7f15ed5
   146     @{syntax_def typefree} & = & @{verbatim "'"}@{text ident} \\
   146     @{syntax_def typefree} & = & @{verbatim "'"}@{text ident} \\
   147     @{syntax_def typevar} & = & @{verbatim "?"}@{text "typefree  |  "}@{verbatim "?"}@{text typefree}@{verbatim "."}@{text nat} \\
   147     @{syntax_def typevar} & = & @{verbatim "?"}@{text "typefree  |  "}@{verbatim "?"}@{text typefree}@{verbatim "."}@{text nat} \\
   148     @{syntax_def string} & = & @{verbatim \<open>"\<close>} @{text "\<dots>"} @{verbatim \<open>"\<close>} \\
   148     @{syntax_def string} & = & @{verbatim \<open>"\<close>} @{text "\<dots>"} @{verbatim \<open>"\<close>} \\
   149     @{syntax_def altstring} & = & @{verbatim "`"} @{text "\<dots>"} @{verbatim "`"} \\
   149     @{syntax_def altstring} & = & @{verbatim "`"} @{text "\<dots>"} @{verbatim "`"} \\
   150     @{syntax_def cartouche} & = & @{verbatim "\<open>"} @{text "\<dots>"} @{verbatim "\<close>"} \\
   150     @{syntax_def cartouche} & = & @{verbatim "\<open>"} @{text "\<dots>"} @{verbatim "\<close>"} \\
   151     @{syntax_def verbatim} & = & @{verbatim "{*"} @{text "\<dots>"} @{verbatim "*"}@{verbatim "}"} \\[1ex]
   151     @{syntax_def verbatim} & = & @{verbatim "{*"} @{text "\<dots>"} @{verbatim "*}"} \\[1ex]
   152 
   152 
   153     @{text letter} & = & @{text "latin  |  "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text latin}@{verbatim ">"}@{text "  |  "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text "latin latin"}@{verbatim ">"}@{text "  |  greek  |"} \\
   153     @{text letter} & = & @{text "latin  |  "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text latin}@{verbatim ">"}@{text "  |  "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text "latin latin"}@{verbatim ">"}@{text "  |  greek  |"} \\
   154     @{text subscript} & = & @{verbatim "\<^sub>"} \\
   154     @{text subscript} & = & @{verbatim "\<^sub>"} \\
   155     @{text quasiletter} & = & @{text "letter  |  digit  |  "}@{verbatim "_"}@{text "  |  "}@{verbatim "'"} \\
   155     @{text quasiletter} & = & @{text "letter  |  digit  |  "}@{verbatim "_"}@{text "  |  "}@{verbatim "'"} \\
   156     @{text latin} & = & @{verbatim a}@{text "  | \<dots> |  "}@{verbatim z}@{text "  |  "}@{verbatim A}@{text "  |  \<dots> |  "}@{verbatim Z} \\
   156     @{text latin} & = & @{verbatim a}@{text "  | \<dots> |  "}@{verbatim z}@{text "  |  "}@{verbatim A}@{text "  |  \<dots> |  "}@{verbatim Z} \\
   183   character codes may be specified as ``@{verbatim \<open>\\<close>}@{text ddd}'',
   183   character codes may be specified as ``@{verbatim \<open>\\<close>}@{text ddd}'',
   184   with three decimal digits.  Alternative strings according to
   184   with three decimal digits.  Alternative strings according to
   185   @{syntax_ref altstring} are analogous, using single back-quotes
   185   @{syntax_ref altstring} are analogous, using single back-quotes
   186   instead.
   186   instead.
   187 
   187 
   188   The body of @{syntax_ref verbatim} may consist of any text not
   188   The body of @{syntax_ref verbatim} may consist of any text not containing
   189   containing ``@{verbatim "*"}@{verbatim "}"}''; this allows
   189   ``@{verbatim "*}"}''; this allows to include quotes without further
   190   convenient inclusion of quotes without further escapes.  There is no
   190   escapes, but there is no way to escape ``@{verbatim "*}"}''. Cartouches
   191   way to escape ``@{verbatim "*"}@{verbatim "}"}''.  If the quoted
   191   do not have this limitation.
   192   text is {\LaTeX} source, one may usually add some blank or comment
       
   193   to avoid the critical character sequence.
       
   194 
   192 
   195   A @{syntax_ref cartouche} consists of arbitrary text, with properly
   193   A @{syntax_ref cartouche} consists of arbitrary text, with properly
   196   balanced blocks of ``@{verbatim "\<open>"}~@{text "\<dots>"}~@{verbatim
   194   balanced blocks of ``@{verbatim "\<open>"}~@{text "\<dots>"}~@{verbatim
   197   "\<close>"}''.  Note that the rendering of cartouche delimiters is
   195   "\<close>"}''.  Note that the rendering of cartouche delimiters is
   198   usually like this: ``@{text "\<open> \<dots> \<close>"}''.
   196   usually like this: ``@{text "\<open> \<dots> \<close>"}''.
   261 \<close>
   259 \<close>
   262 
   260 
   263 
   261 
   264 subsection \<open>Comments \label{sec:comments}\<close>
   262 subsection \<open>Comments \label{sec:comments}\<close>
   265 
   263 
   266 text \<open>Large chunks of plain @{syntax text} are usually given
   264 text \<open>Large chunks of plain @{syntax text} are usually given @{syntax
   267   @{syntax verbatim}, i.e.\ enclosed in @{verbatim "{"}@{verbatim
   265   verbatim}, i.e.\ enclosed in @{verbatim "{*"}~@{text "\<dots>"}~@{verbatim "*}"},
   268   "*"}~@{text "\<dots>"}~@{verbatim "*"}@{verbatim "}"}, or as @{syntax
   266   or as @{syntax cartouche} @{text "\<open>\<dots>\<close>"}. For convenience, any of the
   269   cartouche} @{text "\<open>\<dots>\<close>"}.  For convenience, any of the smaller text
   267   smaller text units conforming to @{syntax nameref} are admitted as well. A
   270   units conforming to @{syntax nameref} are admitted as well.  A
   268   marginal @{syntax comment} is of the form @{verbatim "--"}~@{syntax text}.
   271   marginal @{syntax comment} is of the form @{verbatim "--"}~@{syntax
   269   Any number of these may occur within Isabelle/Isar commands.
   272   text}.  Any number of these may occur within Isabelle/Isar commands.
       
   273 
   270 
   274   @{rail \<open>
   271   @{rail \<open>
   275     @{syntax_def text}: @{syntax verbatim} | @{syntax cartouche} | @{syntax nameref}
   272     @{syntax_def text}: @{syntax verbatim} | @{syntax cartouche} | @{syntax nameref}
   276     ;
   273     ;
   277     @{syntax_def comment}: '--' @{syntax text}
   274     @{syntax_def comment}: '--' @{syntax text}