diff options
-rw-r--r-- | camlp4/lib/plexer.ml | 37 | ||||
-rw-r--r-- | camlp4/ocaml_src/lib/plexer.ml | 44 | ||||
-rw-r--r-- | stdlib/sys.ml | 2 |
3 files changed, 78 insertions, 5 deletions
diff --git a/camlp4/lib/plexer.ml b/camlp4/lib/plexer.ml index 162d99eb6..e12c20084 100644 --- a/camlp4/lib/plexer.ml +++ b/camlp4/lib/plexer.ml @@ -342,20 +342,45 @@ value next_token_fun dfa find_kwd = and quote_in_comment bp = parser [ [: `'''; s :] -> comment bp s - | [: `'\\'; s :] -> quote_antislash_in_comment bp 0 s + | [: `'\013'; s :] -> quote_cr_in_comment bp s + | [: `'\\'; s :] -> quote_antislash_in_comment bp s + | [: `'('; s :] -> quote_left_paren_in_comment bp s + | [: `'*'; s :] -> quote_star_in_comment bp s + | [: `'"'; s :] -> quote_doublequote_in_comment bp s | [: `_; s :] -> quote_any_in_comment bp s | [: s :] -> comment bp s ] and quote_any_in_comment bp = parser [ [: `'''; s :] -> comment bp s | [: s :] -> comment bp s ] - and quote_antislash_in_comment bp len = + and quote_cr_in_comment bp = + parser + [ [: `'\010'; s :] -> quote_any_in_comment bp s + | [: s :] -> quote_any_in_comment bp s ] + and quote_left_paren_in_comment bp = + parser + [ [: `'''; s :] -> comment bp s + | [: s :] -> left_paren_in_comment bp s ] + and quote_star_in_comment bp = parser [ [: `'''; s :] -> comment bp s + | [: s :] -> star_in_comment bp s ] + and quote_doublequote_in_comment bp = + parser + [ [: `'''; s :] -> comment bp s + | [: _ = string bp 0; s :] -> comment bp s ] + and quote_antislash_in_comment bp = + parser + [ [: `'''; s :] -> quote_antislash_quote_in_comment bp s | [: `('\\' | '"' | 'n' | 't' | 'b' | 'r'); s :] -> quote_any_in_comment bp s | [: `('0'..'9'); s :] -> quote_antislash_digit_in_comment bp s + | [: `'x'; s :] -> quote_antislash_x_in_comment bp s | [: s :] -> comment bp s ] + and quote_antislash_quote_in_comment bp = + parser + [ [: `'''; s :] -> comment bp s + | [: s :] -> quote_in_comment bp s ] and quote_antislash_digit_in_comment bp = parser [ [: `('0'..'9'); s :] -> quote_antislash_digit2_in_comment bp s @@ -364,6 +389,14 @@ value next_token_fun dfa find_kwd = parser [ [: `('0'..'9'); s :] -> quote_any_in_comment bp s | [: s :] -> comment bp s ] + and quote_antislash_x_in_comment bp = + parser + [ [: _ = hexa; s :] -> quote_antislash_x_digit_in_comment bp s + | [: s :] -> comment bp s ] + and quote_antislash_x_digit_in_comment bp = + parser + [ [: _ = hexa; s :] -> quote_any_in_comment bp s + | [: s :] -> comment bp s ] and left_paren_in_comment bp = parser [ [: `'*'; s :] -> do { comment bp s; comment bp s } diff --git a/camlp4/ocaml_src/lib/plexer.ml b/camlp4/ocaml_src/lib/plexer.ml index 674fc3f9c..7186c29af 100644 --- a/camlp4/ocaml_src/lib/plexer.ml +++ b/camlp4/ocaml_src/lib/plexer.ml @@ -533,21 +533,47 @@ let next_token_fun dfa find_kwd = and quote_in_comment bp (strm__ : _ Stream.t) = match Stream.peek strm__ with Some '\'' -> Stream.junk strm__; comment bp strm__ - | Some '\\' -> Stream.junk strm__; quote_antislash_in_comment bp 0 strm__ + | Some '\013' -> Stream.junk strm__; quote_cr_in_comment bp strm__ + | Some '\\' -> Stream.junk strm__; quote_antislash_in_comment bp strm__ + | Some '(' -> Stream.junk strm__; quote_left_paren_in_comment bp strm__ + | Some '*' -> Stream.junk strm__; quote_star_in_comment bp strm__ + | Some '\"' -> Stream.junk strm__; quote_doublequote_in_comment bp strm__ | Some _ -> Stream.junk strm__; quote_any_in_comment bp strm__ | _ -> comment bp strm__ and quote_any_in_comment bp (strm__ : _ Stream.t) = match Stream.peek strm__ with Some '\'' -> Stream.junk strm__; comment bp strm__ | _ -> comment bp strm__ - and quote_antislash_in_comment bp len (strm__ : _ Stream.t) = + and quote_cr_in_comment bp (strm__ : _ Stream.t) = + match Stream.peek strm__ with + Some '\010' -> Stream.junk strm__; quote_any_in_comment bp strm__ + | _ -> quote_any_in_comment bp strm__ + and quote_left_paren_in_comment bp (strm__ : _ Stream.t) = + match Stream.peek strm__ with + Some '\'' -> Stream.junk strm__; comment bp strm__ + | _ -> left_paren_in_comment bp strm__ + and quote_star_in_comment bp (strm__ : _ Stream.t) = match Stream.peek strm__ with Some '\'' -> Stream.junk strm__; comment bp strm__ + | _ -> star_in_comment bp strm__ + and quote_doublequote_in_comment bp (strm__ : _ Stream.t) = + match Stream.peek strm__ with + Some '\'' -> Stream.junk strm__; comment bp strm__ + | _ -> let _ = string bp 0 strm__ in comment bp strm__ + and quote_antislash_in_comment bp (strm__ : _ Stream.t) = + match Stream.peek strm__ with + Some '\'' -> + Stream.junk strm__; quote_antislash_quote_in_comment bp strm__ | Some ('\\' | '\"' | 'n' | 't' | 'b' | 'r') -> Stream.junk strm__; quote_any_in_comment bp strm__ | Some ('0'..'9') -> Stream.junk strm__; quote_antislash_digit_in_comment bp strm__ + | Some 'x' -> Stream.junk strm__; quote_antislash_x_in_comment bp strm__ | _ -> comment bp strm__ + and quote_antislash_quote_in_comment bp (strm__ : _ Stream.t) = + match Stream.peek strm__ with + Some '\'' -> Stream.junk strm__; comment bp strm__ + | _ -> quote_in_comment bp strm__ and quote_antislash_digit_in_comment bp (strm__ : _ Stream.t) = match Stream.peek strm__ with Some ('0'..'9') -> @@ -557,6 +583,20 @@ let next_token_fun dfa find_kwd = match Stream.peek strm__ with Some ('0'..'9') -> Stream.junk strm__; quote_any_in_comment bp strm__ | _ -> comment bp strm__ + and quote_antislash_x_in_comment bp (strm__ : _ Stream.t) = + match + try Some (hexa strm__) with + Stream.Failure -> None + with + Some _ -> quote_antislash_x_digit_in_comment bp strm__ + | _ -> comment bp strm__ + and quote_antislash_x_digit_in_comment bp (strm__ : _ Stream.t) = + match + try Some (hexa strm__) with + Stream.Failure -> None + with + Some _ -> quote_any_in_comment bp strm__ + | _ -> comment bp strm__ and left_paren_in_comment bp (strm__ : _ Stream.t) = match Stream.peek strm__ with Some '*' -> diff --git a/stdlib/sys.ml b/stdlib/sys.ml index fac1d78de..fcfda7173 100644 --- a/stdlib/sys.ml +++ b/stdlib/sys.ml @@ -78,4 +78,4 @@ let catch_break on = (* OCaml version string, must be in the format described in sys.mli. *) -let ocaml_version = "3.06+26 (2003-03-26)";; +let ocaml_version = "3.06+27 (2003-03-31)";; |