summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2015-11-30 13:59:32 +0100
committerAlain Frisch <alain@frisch.fr>2015-11-30 13:59:32 +0100
commit33e6f7bf83f2bf801fe7ded3cf178982c0efe5cc (patch)
tree16ddabf12376c0854645ec127db2e8023c609a2c
parent491d972f693d1cb433376ae12e7d786dd6c4c669 (diff)
downloadocaml-33e6f7bf83f2bf801fe7ded3cf178982c0efe5cc.tar.gz
PR#6676: range patterns are now considered part of the core language.
-rw-r--r--manual/manual/refman/exten.etex19
-rw-r--r--manual/manual/refman/patterns.etex14
2 files changed, 13 insertions, 20 deletions
diff --git a/manual/manual/refman/exten.etex b/manual/manual/refman/exten.etex
index 8c78627697..8e0a9fe334 100644
--- a/manual/manual/refman/exten.etex
+++ b/manual/manual/refman/exten.etex
@@ -103,25 +103,6 @@ An expression @@e@@ is said to be {\em immediately linked to} the variable
is immediately linked to @name@.
\end{itemize}
-\section{Range patterns} \label{s:range-patterns}
-
-(Introduced in Objective Caml 1.00)
-
-\begin{syntax}
-pattern: ...
- | char-literal '..' char-literal
-\end{syntax}
-
-In patterns, OCaml recognizes the form
-@"'" @c@ "'" ".." "'" @d@ "'"@ as shorthand for the pattern
-\begin{center}
-@"'" @c@ "'" "|" "'" @c@_1 "'" "|" "'" @c@_2 "'" "|" \ldots
- "|" "'" @c@_n "'" "|" "'" @d@ "'"@
-\end{center}
-where \nth{c}{1}, \nth{c}{2}, \ldots, \nth{c}{n} are the characters
-that occur between \var{c} and \var{d} in the ASCII character set. For
-instance, the pattern "'0'"@'..'@"'9'" matches all characters that are digits.
-
\section{Assertion checking}\label{s:assert}
\ikwd{assert\@\texttt{assert}}
diff --git a/manual/manual/refman/patterns.etex b/manual/manual/refman/patterns.etex
index fa286e0886..cc35b12d99 100644
--- a/manual/manual/refman/patterns.etex
+++ b/manual/manual/refman/patterns.etex
@@ -19,6 +19,7 @@ pattern:
| '[' pattern { ';' pattern } [ ';' ] ']'
| pattern '::' pattern
| '[|' pattern { ';' pattern } [ ';' ] '|]'
+ | char-literal '..' char-literal
\end{syntax}
The table below shows the relative precedences and associativity of
@@ -26,7 +27,7 @@ operators and non-closed pattern constructions. The constructions with
higher precedences come first.
\ikwd{as\@\texttt{as}}
\begin{tableau}{|l|l|}{Operator}{Associativity}
-\entree{".." (see section~\ref{s:range-patterns})}{--}
+\entree{".."}{--}
\entree{"lazy" (see section~\ref{s:lazy})}{--}
\entree{Constructor application, Tag application}{right}
\entree{"::"}{right}
@@ -147,3 +148,14 @@ The pattern @"[|" pattern_1 ";" \ldots ";" pattern_n "|]"@
matches arrays of length $n$ such that the $i$-th array element
matches the pattern @pattern_i@, for \fromoneto{i}{n}.
+\subsubsection*{Range patterns}
+
+The pattern
+@"'" @c@ "'" ".." "'" @d@ "'"@ is a shorthand for the pattern
+\begin{center}
+@"'" @c@ "'" "|" "'" @c@_1 "'" "|" "'" @c@_2 "'" "|" \ldots
+ "|" "'" @c@_n "'" "|" "'" @d@ "'"@
+\end{center}
+where \nth{c}{1}, \nth{c}{2}, \ldots, \nth{c}{n} are the characters
+that occur between \var{c} and \var{d} in the ASCII character set. For
+instance, the pattern "'0'"@'..'@"'9'" matches all characters that are digits.