diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2003-03-31 16:14:45 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2003-03-31 16:14:45 +0000 |
commit | 0ac0d9ac3bef9cd9e3e0c41efc85ece70216f11e (patch) | |
tree | 26a2f0296aabb405bfce97c8490465fd723b7fad /camlp4/ocaml_src | |
parent | 97247d3dbe0df05ba83cb3f3ba3b19665b7efbf1 (diff) |
PR#1610
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5470 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4/ocaml_src')
-rw-r--r-- | camlp4/ocaml_src/lib/plexer.ml | 44 |
1 files changed, 42 insertions, 2 deletions
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 '*' -> |