Commit Graph

125 Commits (ee8f71101b80496b2ec2c996d29ac33bbaf7cf00)

Author SHA1 Message Date
Damien Doligez 7303ac34ca fix some of the whitespace problems in the source
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14582 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-12 10:17:02 +00:00
Alain Frisch 132ff51559 Some preparation for record arguments.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record2@14505 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-28 17:08:53 +00:00
Gabriel Scherer 09900da7c0 Pprintast: factorize handling of infix/prefix binders
There was a bug with "external _pipe = ..." in
otherlibs/threads/unix.ml where the identifier _pipe was wrongly
detected as infix and reprinted as "external ( _pipe ) = ...", causing
a syntax error.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14503 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-28 13:55:22 +00:00
Jacques Garrigue 3b4d7cf63b Merge module-alias branch (cf. PR#6063)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14394 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-01-10 07:53:33 +00:00
Jacques Garrigue cfa350c31a merge generative functors
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14365 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-12-17 03:52:50 +00:00
Alain Frisch 2086ac55e6 #6246: allow wildcard pattern as for-loop index. ==> Camlp4 will need to be adapted.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14333 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-12-02 18:00:18 +00:00
Jacques Garrigue 97899f37ca Support module aliases.
Namely, you can write "module L = List" in signatures,
and avoid have the compiler use directly List when you write L.
See examples in testsuite/tests/typing-modules/aliases.ml


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/module-alias@14196 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-29 07:22:34 +00:00
Alain Frisch 411eb41b42 Allow an optional 'when' clause after a pattern payload.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13920 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-22 15:15:07 +00:00
Alain Frisch 87d9d6c877 More explicit internal representation of attribute payload. Now also support patterns as payload [%id ? pat].
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13919 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-22 14:58:15 +00:00
Alain Frisch 525ef9d703 Synchronize with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13897 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-16 13:34:30 +00:00
Alain Frisch 2e199ef1f2 Item attributes on each let-binding.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13736 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-03 15:14:19 +00:00
Jérémie Dimino 8cee3aedf9 Revert addition of raw literals to the parsetree
It turns out it is not possible to have the exact raw representation
since a constant does not always correspond to exactly one token, so
there is no point in making the AST more complex.


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13702 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-23 15:12:04 +00:00
Damien Doligez c3bf54a7b6 merge changes from version/4.00 from 4.00.1 to r13697
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13699 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-22 12:56:54 +00:00
Jérémie Dimino 4e7ae971a7 add the raw representation of constants to the parsetree
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13696 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-20 11:37:41 +00:00
Alain Frisch a3b1c67fff #5980: explicit way to silence the new warning (open! X).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13685 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-16 13:34:53 +00:00
Alain Frisch 365bcdeadc Print attributes on types and patterns.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13598 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-23 13:53:47 +00:00
Alain Frisch eb4130e47c The arument of attributes and extension nodes is now a structure, which is syntactically more general than an expression (through the embedding E -> [Pexp_eval E]).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13579 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-19 07:40:57 +00:00
Alain Frisch 67912da346 Allow abstract module declaration in structures to make the syntax and Parsetree more uniform.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13556 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-18 13:14:53 +00:00
Alain Frisch 84147074f9 Split Pexp_constraint into Pexp_coerce/Pexp_constraint.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13552 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-17 12:23:44 +00:00
Alain Frisch d2171a98d8 Split Pexp_function into Pexp_function/Pexp_fun.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13551 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-17 11:43:29 +00:00
Alain Frisch b36ec9f764 Get rid of the 'explicit arity' flag on Pexp_construct/Ppat_construct. If really requires (for camlp5?), the feature should be reimplemented with attributes.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13549 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-17 09:46:52 +00:00
Alain Frisch 501dfd2b5e Getting rid of Pexp_assertfalse/Texp_assertfalse.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13548 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-17 09:18:03 +00:00
Alain Frisch 088de517d8 Keep interval pattern sugar in the Parsetree (Camlp4 parsers still expand them).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13546 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-16 15:34:09 +00:00
Alain Frisch 158bc9c9e3 Get rid of the undocumented syntax #c[>`A] (#5936, #5983).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13542 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-16 12:17:17 +00:00
Alain Frisch 3fe10139ab Better representation of with-constraints.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-16 10:47:45 +00:00
Alain Frisch ecb088015f Rename Pcty_fun to Pcty_arrow (and idem in Types, Typedtree, Outcometree) to be coherent with Ptyp_arrow.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13536 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-16 08:59:09 +00:00
Alain Frisch bfc9a8f9e1 Get rid of the location argument on pci_params, and improve location of error messages.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13534 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-16 07:51:27 +00:00
Alain Frisch e7736899fb Explicit representation of guards, get rid of Pexp_when.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13528 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-15 16:23:22 +00:00
Alain Frisch 57f1133e0a Represent the closed flag of Ptyp_variant using closed_flag instead of bool, and start documenting the Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13517 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-12 16:08:52 +00:00
Alain Frisch 04de43bee5 Attributes on Pstr_eval.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13512 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-11 14:07:32 +00:00
Alain Frisch 92ad47d47b Keep item attributes on let-binding structure items.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13511 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-11 13:52:06 +00:00
Alain Frisch d5682ed9cf A -ppx rewriter to evaluate expressions at compile time.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13506 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-11 12:21:02 +00:00
Alain Frisch 94106bf007 Starting to work on printing attributes in pprintast.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13505 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-11 07:53:48 +00:00
Alain Frisch 90bbd25948 Extension nodes as class field or class type field.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13502 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-10 17:54:54 +00:00
Alain Frisch 6e36fd566b Extension nodes and attributes for class types.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13501 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-10 17:44:15 +00:00
Alain Frisch ee5f754a42 Attributes and extension points in class_expr.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13500 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-10 17:26:55 +00:00
Alain Frisch e2036c5a22 Start to bring constructor names closer to concrete syntax.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13497 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-10 11:17:41 +00:00
Alain Frisch 580bb34579 Renaming pcstr_pat -> pcstr_self, cstr_pat -> cstr_self.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13496 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-10 09:35:09 +00:00
Alain Frisch 1eb1ec4c40 Get rid of core_field_type, more direct representation of object types.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13489 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-09 13:29:00 +00:00
Alain Frisch 47a3ee095e Get rid of the Default case in Asttype.rec_flag.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13481 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-04 12:38:20 +00:00
Alain Frisch 27d523ea72 Better representation of variance in the Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13474 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-02 15:33:35 +00:00
Alain Frisch 6bfcb1da5b Support for quoted strings.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13450 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-26 11:17:17 +00:00
Alain Frisch 0b9347f482 Represent exception declarations as constructor declarations in the Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13442 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 15:49:10 +00:00
Damien Doligez c63f9e0957 fix a few problems with whitespace and over-long lines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13393 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-09 22:38:52 +00:00
Alain Frisch b0987fd693 Attributes on expresions (etc) are now stored in the expression record, to facilitate pattern matching on structured fragments of AST while ignoring attributes. Introducing a new Ast_helper module to help creating AST fragments.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13381 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-08 14:59:45 +00:00
Alain Frisch 97c5f1a253 Attributes on label in record type declarations.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13361 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 13:51:18 +00:00
Alain Frisch d50038cae7 Attribute has structure/signature item.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13359 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 12:27:32 +00:00
Alain Frisch 2cf65c8c85 Record for module type declarations.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13358 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 12:14:02 +00:00
Alain Frisch 24a0c6eb0e Name is part of the value_description record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13357 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 12:00:18 +00:00
Alain Frisch 241abe55e6 Type name is part of the type declaration record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13356 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 11:47:59 +00:00
Alain Frisch 59bdf321d3 Switch Pstr_modtype argument to a record type.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13355 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 10:49:44 +00:00
Alain Frisch d32b19008a Parse recursive module as standard modules, and check in the type-checker that an explicit type is provided. (Unfinished.)
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13353 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 16:50:05 +00:00
Alain Frisch cc70961d4f Support item attributes on exn rebind.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13351 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 12:44:40 +00:00
Alain Frisch b01b7305bd Put name in the exception_declaration record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13350 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 12:37:17 +00:00
Alain Frisch db579b0a1e Extension as structure/signature items [%%lid expr].
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13346 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 11:46:25 +00:00
Alain Frisch 8461db39f1 Attributes on module/module type/recursive module declarations in interfaces.
Module:

[^^id expr] [^^id expr] ...
module X : S
[@@id expr] [@@id expr] ...

Module types:

[^^id expr] [^^id expr] ...
module type X = S
[@@id expr] [@@id expr] ...

Recursive modules:

module rec [^^id expr] [^^id expr] X1 : S1 [@@id expr] [@@id expr] ...
       and [^^id expr] [^^id expr] X1 : S1 [@@id expr] [@@id expr] ...




git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13344 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 17:39:07 +00:00
Alain Frisch a5059464fe Attributes on open/include in signatures.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13343 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 16:36:32 +00:00
Alain Frisch 46c790a663 Attributes on exception declarations.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13342 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 16:20:49 +00:00
Alain Frisch 5f0aead005 Adding attributes on constructor declarations (type t = A [@id expr] | B [@id expr] of ...), and switch to a record type to represent those constructor declarations in the Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13338 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 15:35:47 +00:00
Alain Frisch be76a15a6b Attributes/extensions as module types.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13336 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 14:11:15 +00:00
Alain Frisch a2acbc8d3b Adding extension/attribute on patterns.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13335 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 13:52:23 +00:00
Alain Frisch e58b2cd036 Continue.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13333 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 12:54:57 +00:00
Alain Frisch c8d3ff52a2 Cleanup + support attributes on type declarations (syntax: type t = ... with (:a1 expr1) (:a2 expr2) ... (:an exprn)).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13332 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-01 12:44:04 +00:00
Alain Frisch 152255e512 First version with attributes and extensions on expressions, type expressions and structure items.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13330 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-02-28 16:51:59 +00:00
Hongbo Zhang 23994ac6de pprintast.ml: fix a bug for printing private types and tune some identations
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13308 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-02-22 04:04:16 +00:00
Hongbo Zhang 2854b1d448 desuaring Bigarray syntax for -dsource
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13131 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-12-14 02:57:43 +00:00
Hongbo Zhang 8930e12294 tune the indentation of [let rec ... and ...] and fix the bug of ~+
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13092 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-12 14:30:45 +00:00
Hongbo Zhang c1ba7d773a fix indentation of parsing/pprintast.ml and a minor bug let _ as f = fun .. -> ..
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13064 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-05 14:30:56 +00:00
Hongbo Zhang 8c0fb4317c bug fix for parsing/pprintast.ml, now pprintast pass tests of all the files in the compiler directory, including camlp4
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-03 02:20:16 +00:00
Hongbo Zhang 6b8f3706bd bug fix for parsing/pprintast.ml and add tools/eqparsetree to diff two parsetree
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13059 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-02 14:13:56 +00:00
Hongbo Zhang 7ee1f3e11e fix a typo in record printing
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13058 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-01 17:45:30 +00:00
Hongbo Zhang 6ee61c4c2f desguaring record syntax sugar
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13055 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-31 23:52:00 +00:00
Hongbo Zhang 920fbd3145 make pprintast usable
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13054 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-31 18:11:33 +00:00
Alain Frisch dfa500533a #5741: make Pprintast available from the command-line (-dsource).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13025 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-17 16:09:38 +00:00
Alain Frisch 3ffcd66100 #5741: link pprintast into the compiler (unused for now, but it is available in compiler-libs).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13024 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-17 15:50:07 +00:00