aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing/cLexer.ml4
diff options
context:
space:
mode:
authorGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2016-10-05 08:16:42 +0200
committerGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2016-10-05 08:16:42 +0200
commit2fb1f4f1bfdae2fe65c02048380fe8b6e619483e (patch)
tree848531635f96958a5b0762ea5d2170434e80138a /parsing/cLexer.ml4
parent1969e10f25df0c913600099b7b98ea273a064017 (diff)
Revert "Move bullet detection from lexer to parser (bug #5102)."
Diffstat (limited to 'parsing/cLexer.ml4')
-rw-r--r--parsing/cLexer.ml414
1 files changed, 14 insertions, 0 deletions
diff --git a/parsing/cLexer.ml4 b/parsing/cLexer.ml4
index fcdc37c08..bec891f7f 100644
--- a/parsing/cLexer.ml4
+++ b/parsing/cLexer.ml4
@@ -479,6 +479,14 @@ let find_keyword loc id s =
| None -> raise Not_found
| Some c -> KEYWORD c
+let process_sequence loc bp c cs =
+ let rec aux n cs =
+ match Stream.peek cs with
+ | Some c' when c == c' -> Stream.junk cs; aux (n+1) cs
+ | _ -> BULLET (String.make n c), set_loc_pos loc bp (Stream.count cs)
+ in
+ aux 1 cs
+
(* Must be a special token *)
let process_chars loc bp c cs =
let t = progress_from_byte loc None (-1) !token_tree cs c in
@@ -544,6 +552,12 @@ let rec next_token loc = parser bp
| _ -> ()
in
(t, set_loc_pos loc bp ep)
+ | [< ' ('-'|'+'|'*' as c); s >] ->
+ let t,new_between_com =
+ if !between_com then process_sequence loc bp c s, true
+ else process_chars loc bp c s,false
+ in
+ comment_stop bp; between_com := new_between_com; t
| [< ''?'; s >] ep ->
let t = parse_after_qmark loc bp s in
comment_stop bp; (t, set_loc_pos loc ep bp)