Commit Graph

692 Commits (1ef3f35c02db1cfa5b4ff8e36a3b76c96b9db54d)

Author SHA1 Message Date
Mark Shinwell 7c1003d6bc Merge pull request #477 from trefis/4.03-docstrings
GPR#477: docstrings
2016-03-03 13:19:09 +00:00
KC Sivaramakrishnan e21ad4fdcf Minor prettify pretty printing of tuple types and constructor declaration 2016-02-25 13:59:54 +00:00
Jeremie Dimino 7245742974 fix printing of prefix operator applications
Fix printing of prefix operator applications with multiple arguments
and/or labelled arguments.

Old output (invalid syntax):

  ! 1 2 3
  ! ~a:42

New output:

  (!) 1 2 3
  (!) ~a:42
2016-02-25 10:33:28 +00:00
Spiros Eliopoulos fae63549cc fix printing of operator applications with labeled arguments
When infix operators are defined to have labeled arguments, such as:

  let (++) ~n1 ~n2 = n1 + n2

... applications of the infix operator using labeled arguments like
this:

  (++) ~n1:10 ~n2:20

would be printed out like this, which is a syntax error:

  ~n1:10 ++ ~n2:20
2016-02-25 10:21:43 +00:00
Spiros Eliopoulos 7543d73d83 Fix printing of type delcs that use 'private' keyword
type t = private A | B
  type u = t = private A | B

Was previously printed out as:

  type t = private A | B
  type u = private t = A | B
2016-02-24 13:28:51 +00:00
Jeremy Yallop 5ce273b2e0 Fix printing for constrained infix operator bindings:
let (++) : _  = (+)

was previously printed as

   let ++ : _  = (+)
2016-02-22 19:59:02 +00:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Damien Doligez ee8f71101b clean up whitespace and cut long lines 2016-02-17 13:36:27 +01:00
Drup f0a32ab44b Add ext/attrs shortcut on module and module type expressions. 2016-02-05 14:47:09 +01:00
Drup c815a6324b Add ext/attrs shortcut on class expressions. 2016-02-05 14:47:09 +01:00
Drup cd7f89b903 Add ext/attrs shortcut on patterns. 2016-02-05 14:47:09 +01:00
Drup 265beecaef Add ext/attrs shortcut for pack/unpack of modules. 2016-02-05 14:47:09 +01:00
Drup a25f7420ca Allow per-binding attributes on lets. 2016-02-05 14:47:09 +01:00
Drup e02ea43ce3 Add ext/attrs shortcut on include. 2016-02-05 14:47:09 +01:00
Drup d8625b4157 Add ext/attrs shortcut on module type. 2016-02-05 14:47:09 +01:00
Drup b03a13cc3d Add ext/attrs shortcut on open. 2016-02-05 14:47:09 +01:00
Drup f693af0861 Add ext/attrs shortcut on classes. 2016-02-05 14:47:09 +01:00
Drup b2968b3412 Add ext/attrs shortcut on primitives and val. 2016-02-05 14:47:09 +01:00
Drup 091adaa818 Add ext/attrs shortcut on module declarations. 2016-02-05 14:47:09 +01:00
Drup e9dfb906ac Add ext/attrs shortcut on module definition. 2016-02-05 14:47:09 +01:00
Drup e2baa9aa29 Add ext/attrs shortcut on type and exception declarations. 2016-02-05 14:47:09 +01:00
Drup b879f07c2e Add utilities for extension and attributes. 2016-02-05 14:47:09 +01:00
Damien Doligez 05d09f3a96 PR#6977: String literals in comments interpret escape sequences 2016-02-03 13:43:44 +01:00
Runhang Li 80260ef657 Disallow ``::'' for consistency 2016-01-28 14:37:18 -08:00
Runhang Li e2d26d1a16 Allow ``::`` surrounded by parenthesis as...
constructor name
2016-01-28 14:37:18 -08:00
Runhang Li 4145e68dad Allow ``[]`` as a user-defined constructor 2016-01-28 14:37:17 -08:00
Nicolas Ojeda Bar e343dd0ba6 Adapt emit_external_warnings and error_if_has_deep_native_repr_attributes 2016-01-27 23:05:28 +01:00
Nicolas Ojeda Bar 92d679f791 Use Ast_iterator for Ast_invariants 2016-01-27 23:02:23 +01:00
Nicolas Ojeda Bar ff1ecd8fcd Add Ast_iterator 2016-01-27 23:02:23 +01:00
Jeremie Dimino d8704f6ba8 Add module Ast_invariants
This module checks all the AST invariants. This is to ensure that all
invariants are written down in one place and are consistently checked
between the various clients of the AST (typer, pprintast, ...).

The invariants are checked in Pparsee, after applying the ppx
rewriters.
2016-01-27 18:41:12 +00:00
Rafaël Bocquet 3c2f747f0b GPR#112: octal escape sequences for char and string literals
merged by Damien Doligez
2016-01-26 17:32:31 +01:00
alainfrisch 87de6a160d Useless bindings, unit patterns, whitespace. 2016-01-19 23:40:55 +01:00
Drup 8a9d074902 Add Ast_helper.Const, for constants. 2016-01-18 00:27:37 +01:00
Drup 6095df954e Rename parsetree constants.
PConst -> Pconst
int -> integer
2016-01-18 00:12:38 +01:00
Drup 6bb1c73197 Add comments on Parsetree's constants. 2016-01-18 00:12:38 +01:00
Gabriel Scherer 9bc195f313 Merge pull request #426 from nojebar/compile-with-principal
Build compiler with with -principal
2016-01-14 13:53:49 -05:00
Nicolas Ojeda Bar c242a29b12 Compile with -principal 2016-01-14 15:29:41 +01:00
Mark Shinwell 22c15cc2c1 Debuginfo.to_location and Location.print_compact 2016-01-13 16:20:23 +00:00
Damien Doligez 355c982328 PR#6574: get better backtraces in case of compiler crash 2016-01-12 16:51:35 +01:00
Drup ba8eb65195 Slight improvements to pretty printing of attributes. 2016-01-08 03:05:02 +01:00
alainfrisch e1e03820e5 Fix #7097: improve syntax errors for illegal package types
The current fix is to rely on the parsing rules for generic module types, and then
extract a package type, enabling more explicit error messages.  Alternatively, one
could keep the generic module type in the Parsetree and extract the package type
at type-checking time.  But I don't feel like touching the Parsetree definition so
close from a release, consider the impact on Camlp4/5, PPX mappers and other
syntactic tools.
2016-01-05 13:10:25 +01:00
octachron 551f2e5373 PR#7075: fix repeated documentation comments
This commit adds a hook in "parsing/lexer.ml{i,l}" to deactivate the generation of
docstring items. This hook is used by ocamldoc to avoid interferences between these
items and the ocamldoc documentation comments parser.
2015-12-17 23:46:03 +01:00
pierreweis b8502751d0 Details: prefer * ) to *) in literal definitions. 2015-12-17 20:06:35 +01:00
alainfrisch 713447b9e4 Fix #7098 (loss of ppx context in toplevel after an exception)
When a ppx raised an exception, it was returned as an error "extension node" to
the caller, without including the "ppx context" which includes in particular ppx
cookies.  This was fine when only one ppx was used, since in that case, the
missing context was not restored.

When multiple ppx are chained, however, the second ppx sees the result of the
first one, and it it does not contains a context, an empty one is created and
returned to the caller, which has the effect of destroying the context for the
next invocation of ppxs.

The current fix is to ensure that when a "error extension node" is returned, the
context is correctly added to it.  In addition to fixing the reported bug, it also
allow ppx to update their cookies before raising an exception, which can be
useful.
2015-12-17 14:59:33 +01:00
Drup 4f6e4144ff Add signature payloads for extension and attributes. 2015-12-09 14:26:06 +01:00
Gabriel Scherer c6b5a28d77 Merge pull request #320 from gasche/revert-user-defined-indexing-operators
Revert user defined indexing operators
2015-12-06 17:56:40 +01:00
Hugo Heuzard 9eca3e4519 Parse arbitrary precision integers ..
.. 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
2015-12-03 17:20:48 +01:00
alainfrisch 110835872c This also reserves the use of '_' as a valid expression (i.e. other
changes to the grammar that would introduce a conflict with it will now
be detected) for possible later use.
2015-12-03 13:42:24 +01:00
alainfrisch 01bf671f33 PR#6865: remove special case for "let _ = expr" structure items.
This form used to produce Pstr_eval instead of Pstr_let.  This would
probably come as a suprise for people matching on the Parsetree (e.g.
for a ppx).  This special case is now removed.

To avoid a (probably harmless) regression in bytecode, the compilation
of "let _ = ..." bindings (including local ones) is optimized to remove
a useless introduction of a variable (which would occupy a stack slot
otherwise).

The source code printer (-dsource) now prints Pstr_eval as ";;expr",
which should always be ok.  One could avoid ";;" at the beginning of
the structure, but since it is allowed, it is probably not worth adding
complexity here.
2015-12-02 23:39:19 +01:00
alainfrisch 6b9d72d532 A new builtin attribute ocaml.deprecated_mutable; can be applied to a record label so as to trigger a Deprecated warning if the field is mutated. 2015-12-02 18:20:24 +01:00