From a0791f97ad06549f292a888f08712e1fa93d9eba Mon Sep 17 00:00:00 2001 From: Hyeonung Baek Date: Tue, 22 Feb 2022 17:05:21 +0900 Subject: [PATCH] Add comment --- lex.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lex.ml b/lex.ml index d155eaa..0d8fed7 100644 --- a/lex.ml +++ b/lex.ml @@ -9,6 +9,8 @@ let expected col c = raise @@ Expected (col, c) let either f g c = f c || g c +(* test functions *) + let is_digit c = '0' <= c && c <= '9' @@ -30,10 +32,11 @@ let is_ident_start = let is_ident = either is_ident_start is_digit +(* expect_char expects c at col of seq. If not, raise Expected. *) let expect_char col c seq = match seq () with | Seq.Nil -> expected col c - | Seq.Cons ((_, x), seq) -> + | Seq.Cons ((col, x), seq) -> if x = c then seq else expected col c let expect_token str tok seq =