Skip to content
Snippets Groups Projects
Commit 0b180ec2 authored by Putegnat Theo's avatar Putegnat Theo
Browse files

lexeur fonctionne sauf pour des commentaires

parent 4b71c93d
Branches
No related tags found
No related merge requests found
......@@ -97,7 +97,7 @@ let list_regexp : (regexp * (string -> token option)) list =
(keyword_regexp ">", fun _ -> Some (SYM_GT));
(keyword_regexp "<=", fun _ -> Some (SYM_LEQ));
(keyword_regexp ">=", fun _ -> Some (SYM_GEQ));
(Cat(digit_regexp , plus(identifier_material)), fun s -> Some (SYM_IDENTIFIER s));
(plus(identifier_material), fun s -> Some (SYM_IDENTIFIER s));
(* end TODO *)
(Cat(keyword_regexp "//",
Cat(Star (char_range (List.filter (fun c -> c <> '\n') alphabet)),
......
......@@ -390,8 +390,10 @@ let tokenize_one (d : dfa) (w: char list) : lexer_result * char list =
| Some qnext ->
match List.assoc_opt qnext d.dfa_final with
| None -> recognize qnext r (current_token @ [c]) last_accepted
| Some t -> recognize qnext r (current_token @ [c]) (LRtoken (Option.get(t (string_of_char_list (current_token @ [c])))),r)
| Some t ->
match t (string_of_char_list (current_token @ [c])) with
| None -> recognize qnext r (current_token@[c]) (LRskip,r)
| Some token -> recognize qnext r (current_token @ [c]) (LRtoken token,r)
in
recognize d.dfa_initial w [] (LRerror, w)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment