Value patterns match on a value (the result of computation), while
computation patterns handle the effects (hint hint) of
a computation. The only forms of computation patterns in OCaml today
are value patterns and exception patterns (exception p).
The sub-pattern `p` of the `lazy p` construction should be
a computation pattern, rather than a value pattern. This pull-request
does not make this change.
Most of the changes in this PR are boilerplate -- it really is a lot
of work now to add a new syntactic category to the typed-tree
syntax. This boilerplate is fairly automatic and should be easy to
review.
There is a subtle part to the patch, though: the implementation of the
pattern type-checking. It now has to reconstruct the value/computation
distinction (absent from the parse-tree), and return values from two
different types. Instead of splitting the type-checker in several
functions (which risked code duplications), I choose to use a GADT to
have the same [type_pat] function return two different types depending
on the caller. This is the least invasive way to adapt this part of
the codebase, whose inherent complexity is so large (unfortunately)
that adding a GADT to the mix barely makes a difference.
.. and allow any letter in [g-zG-Z] as modifier (previously 'l','L','n')
Also allow modifier for floats
This give more freedom to ppx rewritters (what about a ppx for zarith)
Checks are performed when translating from Parsetree to Typedtree.
Invalid_literal is raised if the modifier is not recognized ([lLn]?)
Integer_overflow is raised as before.
Lexer: use g-zG-Z for integer literal modifier
Lexer: Allow modifier on float
Clean wrt previous commits
Lexer: use named substring
Cleanup
typo
doc
fix after rebase
rebase on trunk
Update typecore.ml
Fix printast.ml
This allows library user to override the untyping behavior of specific
typedtree nodes.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15888 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
This makes them available in compiler-libs, enabling various uses
outside the compiler.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15886 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02