diff --git a/lib/src/Quox/Lexer.idr b/lib/src/Quox/Lexer.idr index b385815..f5a901c 100644 --- a/lib/src/Quox/Lexer.idr +++ b/lib/src/Quox/Lexer.idr @@ -96,6 +96,7 @@ tokens = choice [ simple [","] $ P Comma, simple ["::", "∷"] $ P DblColon, simple [":"] $ P Colon, -- needs to be after "::" + simple ["."] $ P Dot, simple ["->", "→"] $ P Arrow, simple ["=>", "⇒"] $ P DblArrow, @@ -103,9 +104,10 @@ tokens = choice [ simple ["<<", "⊲"] $ P Triangle, match wild $ const $ P Wild, - keyword "fun" Fun, keyword "λ" Fun, - keyword "let" Let, keyword "in" In, - keyword "case" Case, keyword "of" Of, + keyword "fun" Fun, keyword "λ" Fun, + keyword "let" Let, keyword "in" In, + keyword "case" Case, keyword "of" Of, + keyword "ω" Omega, simple ["#"] $ K Omega, match name $ Name, match symbol $ Symbol . assert_total strTail, diff --git a/lib/src/Quox/Token.idr b/lib/src/Quox/Token.idr index 4d51b37..99bc4ff 100644 --- a/lib/src/Quox/Token.idr +++ b/lib/src/Quox/Token.idr @@ -13,6 +13,7 @@ data Punc | LBrace | RBrace | Comma | Colon | DblColon +| Dot | Arrow | DblArrow | Times | Triangle | Wild @@ -22,7 +23,7 @@ data Punc public export data Keyword -= Fun | Let | In | Case | Of += Fun | Let | In | Case | Of | Omega %runElab derive "Keyword" [Generic, Meta, Eq, Ord, DecEq, Show] diff --git a/tests/src/Tests/Lexer.idr b/tests/src/Tests/Lexer.idr index f9f016b..fa67eb7 100644 --- a/tests/src/Tests/Lexer.idr +++ b/tests/src/Tests/Lexer.idr @@ -113,6 +113,7 @@ tests = "lexer" :- [ acceptsWith' "'a" [Symbol "a"], acceptsWith' "'ab" [Symbol "ab"], acceptsWith' "'_b" [Symbol "_b"], + acceptsWith' "a.b.c" [Name "a", P Dot, Name "b", P Dot, Name "c"], rejects' "'", rejects' "1abc" ], @@ -124,6 +125,8 @@ tests = "lexer" :- [ acceptsWith' "in" [K In], acceptsWith' "case" [K Case], acceptsWith' "of" [K Of], + acceptsWith' "ω" [K Omega], + acceptsWith' "#" [K Omega], acceptsWith' "funk" [Name "funk"] ],