Add comment

This commit is contained in:
백현웅 2022-02-22 17:05:21 +09:00
parent 26c6f3d7bf
commit a0791f97ad

5
lex.ml
View file

@ -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 =