diff options
Diffstat (limited to 'parsing/tok.ml')
-rw-r--r-- | parsing/tok.ml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/parsing/tok.ml b/parsing/tok.ml index 4cb94e38b..0ff94d395 100644 --- a/parsing/tok.ml +++ b/parsing/tok.ml @@ -19,6 +19,18 @@ type t = | LEFTQMARK | EOI +let equal t1 t2 = match t1, t2 with +| KEYWORD s1, KEYWORD s2 -> CString.equal s1 s2 +| METAIDENT s1, METAIDENT s2 -> CString.equal s1 s2 +| PATTERNIDENT s1, PATTERNIDENT s2 -> CString.equal s1 s2 +| IDENT s1, IDENT s2 -> CString.equal s1 s2 +| FIELD s1, FIELD s2 -> CString.equal s1 s2 +| INT s1, INT s2 -> CString.equal s1 s2 +| STRING s1, STRING s2 -> CString.equal s1 s2 +| LEFTQMARK, LEFTQMARK -> true +| EOI, EOI -> true +| _ -> false + let extract_string = function | KEYWORD s -> s | IDENT s -> s @@ -89,4 +101,4 @@ let match_pattern = | "EOI", "" -> (function EOI -> "" | _ -> err ()) | pat -> let tok = of_pattern pat in - function tok' -> if tok = tok' then snd pat else err () + function tok' -> if equal tok tok' then snd pat else err () |