From 2fb1f4f1bfdae2fe65c02048380fe8b6e619483e Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Wed, 5 Oct 2016 08:16:42 +0200 Subject: Revert "Move bullet detection from lexer to parser (bug #5102)." This reverts commit 466b7e69e49a5f4bba36b834a2e046f120ece07c. --- parsing/tok.ml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'parsing/tok.ml') diff --git a/parsing/tok.ml b/parsing/tok.ml index 99d5c972c..8ae106512 100644 --- a/parsing/tok.ml +++ b/parsing/tok.ml @@ -18,6 +18,7 @@ type t = | INT of string | STRING of string | LEFTQMARK + | BULLET of string | EOI let equal t1 t2 = match t1, t2 with @@ -29,6 +30,7 @@ let equal t1 t2 = match t1, t2 with | INT s1, INT s2 -> string_equal s1 s2 | STRING s1, STRING s2 -> string_equal s1 s2 | LEFTQMARK, LEFTQMARK -> true +| BULLET s1, BULLET s2 -> string_equal s1 s2 | EOI, EOI -> true | _ -> false @@ -40,6 +42,7 @@ let extract_string = function | FIELD s -> s | INT s -> s | LEFTQMARK -> "?" + | BULLET s -> s | EOI -> "" let to_string = function @@ -50,6 +53,7 @@ let to_string = function | INT s -> Format.sprintf "INT %s" s | STRING s -> Format.sprintf "STRING %S" s | LEFTQMARK -> "LEFTQMARK" + | BULLET s -> Format.sprintf "STRING %S" s | EOI -> "EOI" let match_keyword kwd = function @@ -71,6 +75,7 @@ let of_pattern = function | "INT", s -> INT s | "STRING", s -> STRING s | "LEFTQMARK", _ -> LEFTQMARK + | "BULLET", s -> BULLET s | "EOI", _ -> EOI | _ -> failwith "Tok.of_pattern: not a constructor" @@ -82,6 +87,7 @@ let to_pattern = function | INT s -> "INT", s | STRING s -> "STRING", s | LEFTQMARK -> "LEFTQMARK", "" + | BULLET s -> "BULLET", s | EOI -> "EOI", "" let match_pattern = @@ -94,6 +100,7 @@ let match_pattern = | "INT", "" -> (function INT s -> s | _ -> err ()) | "STRING", "" -> (function STRING s -> s | _ -> err ()) | "LEFTQMARK", "" -> (function LEFTQMARK -> "" | _ -> err ()) + | "BULLET", "" -> (function BULLET s -> s | _ -> err ()) | "EOI", "" -> (function EOI -> "" | _ -> err ()) | pat -> let tok = of_pattern pat in -- cgit v1.2.3