Commit Graph

617 Commits (459061e182aebb646fbd460ffa1822a6d19c9a3f)

Author SHA1 Message Date
Gabriel Scherer c508c47101 colorize error and warning messages, refactor Location
(Simon Cruanes)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16349 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-15 15:57:53 +00:00
Gabriel Scherer 60314e38c5 fix -dsource error on recursive modules
(Hongbo Zhang)

when printing recursive module the old version would print no space
before 'and':
  A : ... = struct
    ...
  endand B : ... = ...

this tiny PR fixes such problem

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16307 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-02 13:05:53 +00:00
Gabriel Scherer 235ee2ddef GPR#26: support for "(type a b ..)" as sugar for "(type a) (type b) .."
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16258 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-26 19:01:42 +00:00
Alain Frisch 63ba313843 Fix merge issue.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16216 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 15:48:36 +00:00
Damien Doligez 860c670848 merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16214 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 14:31:05 +00:00
Alain Frisch 7fdba8f533 GPR214: remove duplicate productions in the parser (patch by Jeremy Yallop).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16213 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 11:51:17 +00:00
Jérémie Dimino 19c45e683a PR6865: Fix parsing of toplevel [let%foo _ = expr]
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16199 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-13 10:47:54 +00:00
Alain Frisch 5b7552b652 Fix bootstrap (broken by ambiguous ocamldoc comments).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16191 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-06-29 17:04:13 +00:00
Leo White 5c55e4cc08 Attach documentation comments to Parsetree
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16189 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-06-28 13:11:50 +00:00
Jérémie Dimino a90f0e4c63 add 'nonrec' as a possible attribute id
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16188 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-06-24 10:15:08 +00:00
Damien Doligez a2c6ac8110 fix small bug in commit 16075
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16076 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-05-04 19:46:51 +00:00
Damien Doligez ea845ce074 GPR#159: Better locations for structure/signature items
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16075 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-05-04 18:44:11 +00:00
Gabriel Scherer f9ea209cb7 GPR#171: allow custom warning printers / catchers
(Benjamin Canou, review by Damien Doligez)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16049 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-26 21:05:26 +00:00
Gabriel Scherer bbb896f4b1 PR#6816: lexer raise for literal number followed by alphanum
(Hugo Heuzard)

The following were previously accepted and are now (rightly) rejected:
  (fun x y -> x,y) 0O56789;;
  (fun x y z t a b -> x,y,z,t,a,b) 0b0l0l0O10l0O6789l0e2;;

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16003 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-12 10:31:14 +00:00
Gabriel Scherer 3376907929 PR#6635: Support M.[], M.(), M.{< >} and M.[| |].
(Jeremy Yallop)

A small follow-up to PR#6054, which added support for the forms

  M.[e1; e2; ... en]
  M.[|e1; e2; ...; en|]
  M.{l1=e1; l2=e2; ... ln=en}
  M.{<e1; e2; ... en>}

This patch adds support for the empty cases:

  M.[]
  M.[||]
  M.()
  M.{<>}

The empty forms aren't particularly useful in themselves, of course,
but the uniformity is convenient.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16002 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-12 09:54:41 +00:00
Alain Frisch b567e4d0b4 #6583: custom # operators are left associative. (Cherry-picked from version/4.02, commit 15952.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15953 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-03-24 13:09:02 +00:00
Jérémie Dimino 050a57649a Fix pretty-printing of extensions in patterns
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15945 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-03-16 18:15:03 +00:00
Jérémie Dimino 7ae6f92e5d Add the "nonrec" keyword and allow it on type
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15919 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-03-13 11:07:57 +00:00
Jérémie Dimino 51ba396328 Add rec_flag to type items in the parsetree and typedtree
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15918 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-03-13 11:07:29 +00:00
Alain Frisch 4c48d802cb #6612: attribute in type expressions bind less then product types; attributes come after constructor/field declarations.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15897 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-03-11 14:57:20 +00:00
Alain Frisch 11333d938c #6583: support for custom #... binary operators (also allowing '#' in trailing symbols, although the operator is then rejected by the type-checker).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15892 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-03-09 17:39:50 +00:00
Jérémie Dimino dc7e685a40 Fix pretty-printing of inlined records
Attributes on label declarations were ignored


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15802 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-01-30 16:24:18 +00:00
Alain Frisch 9bf9d90258 Merge https://github.com/ocaml/ocaml/pull/134: Fix (and simplify) pprintast for optional arguments in types.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15772 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-01-09 08:31:46 +00:00
Alain Frisch 1be542d948 Fix #6679 (pprintast bug around constraint).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15765 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-01-07 11:34:03 +00:00
Damien Doligez ae7b68f230 PR#6663: A misleading typo in parsetree.mli
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15741 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-23 16:52:51 +00:00
Jacques Garrigue 93bae0cc3a Exhauce PR#6611: remove the option wrapper on optional arguments in the syntax tree
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15738 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-22 09:06:02 +00:00
Jacques Garrigue 158480371a exhauce PR#6367: introduce Asttypes.arg_label to encode labelled arguments
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15737 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-22 08:45:55 +00:00
Gabriel Scherer 8b3fdc9dae notes on attributes in pprintast.ml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15678 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-16 14:05:02 +00:00
Gabriel Scherer 094ffa726f PR#6717: Pprintast does not print let-pattern attributes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15677 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-16 13:34:46 +00:00
Gabriel Scherer e88e2bb744 remove unnecessary Obj.magic (Grégoire Henry)
From: Gabriel Scherer <gabriel.scherer@gmail.com>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15664 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-13 22:35:55 +00:00
Gabriel Scherer 4a80e9da11 Simplify the definition of custom .{} operators
This commits modify the Bigarray syntax extension in order to facilitate the use of custom .{} operators. The compatibility with the existing Bigarray syntax has been preserved as much as possible. However, this commit will break code which use the Bigarray .{}
syntax without opening the Bigarray module first!

Like the previous commit, this commit modifies the parser to desugar bigarray1.{index} to ( .{} ) bigarray1 index. Following the bigarray syntax, the index operator used
in the desugaring changes if the index is a n-tuple:
1-tuple => .{}
2-tuple => .{,}
3-tuple => .{,,}
4 and more tuples => .{,..,}

The bigarray modules has been modified to use this new index operators. Note that this means that these index operators are not anymore accessible without opening the bigarray module.

From: octachron <octa@polychoron.fr>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15662 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-13 22:13:37 +00:00
Gabriel Scherer 7e47735db8 Simplify the use of custom .() and .[]
This commit modifies the parser to use the newly defined .() and .[] operators. It also moves the definition of the standard .() and .[] operator for String/Bytes and Array to the pervasives module.

Before this commit, expressions of the form array.(index) and string.(index) where desugared to Array.get[_unsafe] array index and Strinf.get[_unsafe] string index. The unsafe or unsafe version were chosen depending on the presence of the "-unsafe" compiler option. Such expression are now desugared to ( .() ) array index and ( .[] ) string index respectively. The same desugar operation is applied to array.(index) <- value which becomes ( .()<- ) array index value.

In order to keep the standard semantic for the string and array index operations, these new index operators are defined in the pervasives module using new compiler primitives, e.g.
let .() = "%array_opt_get".
These new primitives are then mapped to safe or unsafe version depending on the
the "-unsafe" compiler option. Consequently, these modifications should have no impact on existing code.

With these modifications, defining custom .() and .[] operators should be easier, at the cost of losing access to the standard index operator for either array or string.

From: octachron <octa@polychoron.fr>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15661 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-13 22:13:34 +00:00
Gabriel Scherer 16bc43219c Add a special syntax for index operators
This commit introduces a new syntax for index operators.
Six core parenthesis operator are added:
.(), .[], .{}, .{,}, .{,,}, .{,..,}.
The .{,}/.{,,}/.{,,,} operators are defined for compatibility with the Bigarray syntax extension.
Each core index operator is available in a access/assignement versions. For instance, .() is declined in
* .() : index operator
* .()<- : indexed assignment operator
The general syntax for these index operators as implemented in the parser is index_operator::= index_operator_core [<-]

From: octachron <octa@polychoron.fr>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15660 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-13 22:13:32 +00:00
Alain Frisch 424d01dc35 #6688: fix comment.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15646 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-10 13:39:39 +00:00
Alain Frisch a033839139 #6688: allow val declarations as structure items.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15645 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-10 13:37:50 +00:00
Gabriel Scherer eece1bbe45 Add punning for object copying expressions.
From: Jeremy Yallop <yallop@gmail.com>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15580 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-16 17:52:26 +00:00
Jacques Garrigue 792c92d1a0 Fix PR#6615: inconsistent printing and parsing of inline records
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15559 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-17 01:48:12 +00:00
Damien Doligez 031cffd155 merge branch 4.02 from release 4.02.0 to release 4.02.1
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-15 13:34:58 +00:00
Alain Frisch e3ad818fb5 Reintegrate-merge constructors_with_record5 branch.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15556 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-14 15:51:30 +00:00
Alain Frisch 93863aac89 Factorize code to print constructors.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15508 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-09 12:52:56 +00:00
Gabriel Scherer 44d272a34c Document -ppx option.
From: Peter Zotov <whitequark@whitequark.org>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15475 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-04 10:39:29 +00:00
Alain Frisch e8fd41e2e8 Get rid of type-qualifed constructor paths for extensible types.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15355 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-26 16:25:29 +00:00
Alain Frisch 4c3cd9fb7b Sync with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15334 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-25 15:49:42 +00:00
Alain Frisch bd9c17c8d5 Make it clear that type-qualified constructors are only allowed in bang types.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15333 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-25 15:22:06 +00:00
Alain Frisch 5dac90505f Allow qualified reference to constructors (at least in bang-types). A regular variant type supports qualified constructors of the form: M.t.X. An extensible variant type supports qualified constructors of the form: M.t.N.X.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15332 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-25 15:16:19 +00:00
Alain Frisch 4aa48476d8 Refer to the inlined record type as !M.Foo for a constructor M.Foo.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15315 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-23 16:06:09 +00:00
Alain Frisch 44c2066055 #5904: improve support for ppx in the toplevel by allowing ppx processors to keep information across calls (through the use of persistent cookies). Also change Ast_mapper.register so that the function that creates the mapper from arguments is executed once the context has been restored.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15314 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-23 14:54:01 +00:00
Alain Frisch 378a967cb7 Sync with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15190 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-04 16:11:12 +00:00
Damien Doligez cbfe627f92 merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-22 13:45:02 +00:00
Alain Frisch 2acf7b75f3 #5528: -dsource printer, also fix a bug (present in trunk) when printing GADT constructors with multiple arguments.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15082 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-12 14:58:56 +00:00