PR#5598: (follow-up) handling of string constants in ocamllex should be the same as in ocamlc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14406 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
64dd73a6e0
commit
fd2c7e3be3
10
Changes
10
Changes
|
@ -44,6 +44,7 @@ Bug fixes:
|
|||
- PR#4719: Sys.executable_name wrong if executable name contains dots (Windows)
|
||||
- PR#4855: 'camlp4 -I +dir' accepted, dir is relative to 'camlp4 -where'
|
||||
- PR#5201: ocamlbuild: add --norc to the bash invocation to help performances
|
||||
- PR#5598: follow-up fix related to PR#6165
|
||||
- PR#5820: Fix camlp4 lexer roll back problem
|
||||
- PR#6062: Fix a regression bug caused by commit 13047
|
||||
- PR#6109: Typos in ocamlbuild error messages
|
||||
|
@ -54,10 +55,10 @@ Bug fixes:
|
|||
|
||||
Standard library:
|
||||
- PR#4986: add List.sort_uniq and Set.of_list
|
||||
- PR#6148: speed improvement for Buffer (patch by John Whitington)
|
||||
- PR#6146: support "Unix.kill pid Sys.sigkill" under Windows
|
||||
- PR#6180: efficient creation of uninitialized float arrays
|
||||
- PR#5935: a faster version of "raise" which does not maintain the backtrace
|
||||
- PR#6146: support "Unix.kill pid Sys.sigkill" under Windows
|
||||
- PR#6148: speed improvement for Buffer (patch by John Whitington)
|
||||
- PR#6180: efficient creation of uninitialized float arrays
|
||||
|
||||
OCamldoc:
|
||||
- PR#6257: handle full doc comments for variant constructors and
|
||||
|
@ -69,11 +70,12 @@ Features wishes:
|
|||
hexa representations (patch by Zoe Paraskevopoulou)
|
||||
- PR#5547: Enable the "-use-ocamlfind" option by default
|
||||
- PR#5650: Camlp4FoldGenerator doesn't handle well "abstract" types
|
||||
- PR#5808: allow simple patterns, not only identifiers, in "let p : t = ..."
|
||||
- PR#6064: GADT representation for Bigarray.kind + CAML_BA_CHAR runtime kind
|
||||
- PR#6071: Add a -noinit option to the toplevel (patch by David Sheets)
|
||||
- PR#6166: document -ocamldoc option of ocamlbuild
|
||||
- PR#6246: allow wilcard _ as for-loop index
|
||||
- PR#5808: allow simple patterns, not only identifiers, in "let p : t = ..."
|
||||
|
||||
|
||||
OCaml 4.01.1:
|
||||
-------------
|
||||
|
|
|
@ -30,6 +30,7 @@ let string_buff = Buffer.create 256
|
|||
let reset_string_buffer () = Buffer.clear string_buff
|
||||
|
||||
let store_string_char c = Buffer.add_char string_buff c
|
||||
let store_string_chars s = Buffer.add_string string_buff s
|
||||
|
||||
let get_stored_string () = Buffer.contents string_buff
|
||||
|
||||
|
@ -197,7 +198,7 @@ rule main = parse
|
|||
and string = parse
|
||||
'"'
|
||||
{ () }
|
||||
| '\\' ("\010" | "\013" | "\013\010") ([' ' '\009'] * as spaces)
|
||||
| '\\' ('\013'* '\010') ([' ' '\009'] * as spaces)
|
||||
{ incr_loc lexbuf (String.length spaces);
|
||||
string lexbuf }
|
||||
| '\\' (backslash_escapes as c)
|
||||
|
@ -208,7 +209,7 @@ and string = parse
|
|||
if in_pattern () && v > 255 then
|
||||
warning lexbuf
|
||||
(Printf.sprintf
|
||||
"illegal backslash escape in string: `\\%c%c%c'" c d u) ;
|
||||
"illegal backslash escape in string: '\\%c%c%c'" c d u) ;
|
||||
store_string_char (Char.chr v);
|
||||
string lexbuf }
|
||||
| '\\' 'x' (['0'-'9' 'a'-'f' 'A'-'F'] as d) (['0'-'9' 'a'-'f' 'A'-'F'] as u)
|
||||
|
@ -217,14 +218,15 @@ and string = parse
|
|||
| '\\' (_ as c)
|
||||
{if in_pattern () then
|
||||
warning lexbuf
|
||||
(Printf.sprintf "illegal backslash escape in string: `\\%c'" c) ;
|
||||
(Printf.sprintf "illegal backslash escape in string: '\\%c'" c) ;
|
||||
store_string_char '\\' ;
|
||||
store_string_char c ;
|
||||
string lexbuf }
|
||||
| eof
|
||||
{ raise(Lexical_error("unterminated string", "", 0, 0)) }
|
||||
| '\010'
|
||||
{ store_string_char '\010';
|
||||
| '\013'* '\010' as s
|
||||
{ warning lexbuf (Printf.sprintf "unescaped newline in string") ;
|
||||
store_string_chars s;
|
||||
incr_loc lexbuf 0;
|
||||
string lexbuf }
|
||||
| _ as c
|
||||
|
|
Loading…
Reference in New Issue