Commit Graph

131 Commits (1ef3f35c02db1cfa5b4ff8e36a3b76c96b9db54d)

Author SHA1 Message Date
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 6095df954e Rename parsetree constants.
PConst -> Pconst
int -> integer
2016-01-18 00:12:38 +01:00
Nicolas Ojeda Bar c242a29b12 Compile with -principal 2016-01-14 15:29:41 +01:00
Drup ba8eb65195 Slight improvements to pretty printing of attributes. 2016-01-08 03:05:02 +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 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
Jeremie Dimino 07f5fa92a1 Revert "Update printing of custom index operators"
This reverts commit 7a318f1a64.

(This patch was hand-written to keep some refactoring done in the
reverted patch.)
2015-11-30 16:06:30 +01:00
Jeremie Dimino 7a318f1a64 Update printing of custom index operators 2015-10-28 14:36:10 +00:00
Gabriel Scherer 54e039901e GPR#42: Add simpler functor type syntax
(Leo White)

Add support for simple functor types of the form:

    S -> T

equivalent to:

    functor (_ : S) -> T

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16546 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-25 16:24:47 +00:00
Jacques Garrigue a335b18a45 merge branches/gadt-warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16532 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 08:33:44 +00:00
Alain Frisch 923ad0ec47 Remove or comment-out dead code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16515 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 16:08:12 +00:00
Jacques Garrigue e34f40ad87 switch to 'pat -> .' and add P/Texp_unreachable
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16507 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 00:13:40 +00:00
Jacques Garrigue a09fb037ac add refuted cases, syntax is 'pat -> _'
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16500 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 01:55:52 +00:00
Damien Doligez b860d63145 whitespace cleanup, cut long lines, add some missing headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16415 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-11 11:58:31 +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
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
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
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
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
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
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
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
Alain Frisch 50f47df33a Sync with trunk. Rebinding of inlined extension constructors with free variables is not yet supported.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15069 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-07 16:07:55 +00:00
Damien Doligez 529ad3ed12 PR#6469: -dsource prints Pervasives.(!) as Pervasives.!
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14998 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-07-11 12:07:54 +00:00
Alain Frisch 894af5c4be Fix regression introduced by commit 14809. (Cherry pick commit 14946 from version/4.02.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14947 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-03 09:05:04 +00:00
Gabriel Scherer 9fa17c95a5 temporarily remove %(%) to avoid weaker typing
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14809 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12 15:37:34 +00:00
Alain Frisch 0f1fb19cbe #6318: Extend match...with with exception cases. (Patch by Jeremy Yallop, backend part by A. Frisch).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14743 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-05 11:49:37 +00:00
Alain Frisch 0b3423ef2c #6387: also allow attributes on methods in object types (< m [@foo] : int; ..>).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14741 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-05 11:21:45 +00:00
Jacques Garrigue b56dc4b3df PR#5584: merge open extensible types, extension-patch-4.0.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14737 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-04 23:08:45 +00:00
Alain Frisch 0f1bb864df Add support for floating attributes in class structures and class signatures. (Patch by Leo White.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14736 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-04 20:42:34 +00:00
Alain Frisch b791d666d8 #6387: allow attributes on variants in polymorphic variant types.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14712 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-30 08:19:55 +00:00
Alain Frisch d2de0d7b18 Revert 14616, 14617. Go back to the original syntax for toplevel directives, only allowing capitalized identifiers in addition to lowercase ones. Split #show into variants #show_val, #show_type, etc, and implement a generic #show which combines all the results.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14697 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-28 08:04:43 +00:00
Alain Frisch dfce13de92 Sync with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@14661 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-22 15:40:51 +00:00