From bdb2e9597a05594a0a15d8d76043e474961dc6c4 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sat, 19 Mar 2022 10:20:42 -0700 Subject: [PATCH] chore: naming convention --- tests/lean/run/lex.lean | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/lean/run/lex.lean b/tests/lean/run/lex.lean index cbce4e11fd..b09e8e811d 100644 --- a/tests/lean/run/lex.lean +++ b/tests/lean/run/lex.lean @@ -20,7 +20,7 @@ inductive LexErr where | notDigit : Char → LexErr deriving Repr -def charDigit (char : Char) : Option Nat := +def charDigit? (char : Char) : Option Nat := if char.isDigit then some char.toNat else @@ -34,7 +34,7 @@ mutual | ')' => return { text := ")", tok := Tok.rpar } :: (← lex it.next) | '+' => return { text := "+", tok := Tok.plus } :: (← lex it.next) | other => - match charDigit other with + match charDigit? other with | none => throw <| LexErr.unexpected other | some d => lexnumber d [other] it.next else @@ -43,7 +43,7 @@ mutual def lexnumber [Monad m] [MonadExceptOf LexErr m] (soFar : Nat) (text : List Char) (it : String.Iterator) : m (List Token) := if it.hasNext then let c := it.curr - match charDigit c with + match charDigit? c with | none => return { text := text.reverse.asString, tok := Tok.num soFar } :: (← lex it) | some d => lexnumber (soFar * 10 + d) (c :: text) it.next else