Commit Graph

124 Commits (ec8203077a47324195d33d65189402e69a2e66dc)

Author SHA1 Message Date
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
Xavier Leroy 0c5e862a3e GPR#268: Hexadecimal notation for floating-point numbers
Merge of branch 'hex-float'.

- Add support in byterun/floats.c for conversions between floats and strings in hex notation. We cannot rely on the C standard library here because Microsoft consistently fails at supporting hex notation as standardized in C99. Instead, the conversions are implemented from scratch.
- Add support in the lexer so that hex float literals are recognized in OCaml sources.
- Add support in formats. The ISO C99 format letters for hex floats are %a and %A, but %a is already taken. I chose %h and %H, which are rejected today as bad formats (hence no backward incompatibility) and don't mean anything in C either (h is a modifier, not a format letter).
- Add support in printf. All the trimmings are there in the implementation of %h and %H, including sign modifier and fixed precision.
- Benoit Vaugon contributed support in scanf.

Resolved conflicts:
	boot/ocamlc
	boot/ocamldep
	boot/ocamllex
	parsing/lexer.mll
2015-11-19 10:37:20 +01:00
Leo White bbce6c5768 Put the * back on the doc comments 2015-11-03 12:51:01 +00:00
Pierre Weis bdc8e004de Consistently quoting quote and doublequote into string and character litterals.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16434 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-21 17:39:27 +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
Xavier Leroy bb86f5b545 Preliminary support for hexadecimal notation for FP numbers.
- Primitives:
     caml_float_of_string  extended to recognize "0x" hexa notation
     caml_hexstring_of_float  new primitive
  We do not assume hex floats are supported by the C standard library.
  Instead, conversions hex string <-> float are implemented manually.
- Printf: hex FP output supported with formats %h / %H
- Scanf: remains to be updated (see TODO in stdlib/scanf.ml)


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/hex-float@16257 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-26 09:29:33 +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
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
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 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
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
Damien Doligez 5b8df637d2 merge branch "safe-string"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 11:56:17 +00:00
Fabrice Le Fessant e3aaa68105 Add a hook in the lexer for an internal preprocessor
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14631 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-17 20:19:12 +00:00
Alain Frisch f31ba39923 Custom syntax for floating attributes: [@@@id].
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14588 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-14 14:42:41 +00:00
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
Damien Doligez e8d15e704c merge branch 4.01 from 4.01.0 (revision 14115) to branch closure (revision 14525)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14532 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-04 17:32:35 +00:00
Damien Doligez 64dd73a6e0 PR#6165: Alterations to handling of \013 in source files breaking other tools
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14405 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-01-22 13:04:04 +00:00
Alain Frisch 15da6d1804 Reports the beginning of the string literal in 'This comment contains an unterminated string literal' errors.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14328 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-29 11:35:50 +00:00
Alain Frisch 71efb4666b Switch Lexer.Error to the new system.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14107 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 11:59:45 +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
Damien Doligez e69730e0d6 extend warning 3 to other deprecated features: Latin1, (&) and (or)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13706 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-28 11:05:58 +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
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 f510f9b4a1 Support for quoted strings within comments.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13469 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-29 15:36:24 +00:00
Alain Frisch 180aabbc6b Simplify.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13452 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-26 11:29:48 +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
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 a483bbaaf4 Experimenting with alternative syntax for extension nodes (as an annotation on the opening keyword/delimiter).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13378 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-08 09:17:30 +00:00
Alain Frisch 72a638757c Stand-alone ("floating") sig_item/str_item attributes now use the
standard syntax for item attributes.  They are recognized at the 
beginning of the signature/structure and after a ";;" token.



git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13371 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-07 13:46:44 +00:00
Alain Frisch 63b229658e Remove prefix syntax for attributes.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13368 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-07 13:00:01 +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 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 a64152ae6e Use [%lid expr] syntax for extensions.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13345 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 11:30:15 +00:00
Alain Frisch a3f6606793 Prefix attributes for 'items'.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13340 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 15:53:43 +00:00
Alain Frisch f8706985c2 Adding prefix syntax for attributes [^id expr] ...
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13339 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 15:48:24 +00:00
Alain Frisch 70bc46ef0c New syntax:
Attributes:   ... [@id expr]
 Extension:    [#id expr]
 
 Attributes on items:  ... [@@id expr]




git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13337 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 15:00:30 +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
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Alain Frisch f6f54d325d #4762: QUESTIONQUESTION is no longer a token.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12795 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-07-30 10:15:10 +00:00
Fabrice Le Fessant d39d43e55f merge with branch bin-annot
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12516 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-30 14:52:37 +00:00
Damien Doligez ee4e2fb927 PR#5598: fix bug in commit 12420
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12424 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-03 11:51:08 +00:00
Damien Doligez 8c17777b85 PR#5598: remove macos9-style newline support
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12420 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-02 14:44:38 +00:00
Alain Frisch d79455bc76 New syntax for 'custom let bindings': let.simple_expr pat = expr in expr
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11906 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-12-21 08:58:56 +00:00
Alain Frisch 16c26c6de3 let-like operators.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11894 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-12-20 11:22:32 +00:00
Pierre Weis 87946c9536 Get rid of spurious warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11252 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-10-28 21:21:55 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Jacques Garrigue ee36e1d1c5 merge branches/override
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10250 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-04-08 03:58:41 +00:00
Damien Doligez cfd555426d no warning 29 for strings in comments
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10248 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-04-07 14:35:46 +00:00
Damien Doligez 1b8095f404 PR#4940: get rid of naked end-of-lines in string constants + add warning 29
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9512 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-07 15:15:07 +00:00
Pierre Weis 7ad9cd975b To deal with printf output for %F format, adding a unary + operator.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9454 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2009-12-07 16:40:39 +00:00