feat(lexer): implement numericEntity lexer

This commit is contained in:
Primrose 2025-09-26 16:51:18 +08:00
parent 970b658926
commit 5073fc0e25
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
2 changed files with 42 additions and 1 deletions

View file

@ -30,6 +30,7 @@ main = hspec $ do
it "bird tracks" birdTracks
it "module names" modules
it "quotes" quotes
it "numeric entity" numericEntity
it "ignores nesting" ignoreNesting
describe "Parser" do
@ -152,6 +153,18 @@ space = do
, (1, 2, Newline)
]
numericEntity :: Expectation
numericEntity = do
"A λ"
`shouldLexTo` [ (1, 1, NumericEntity 65)
, (1, 6, Space)
, (1, 7, NumericEntity 955) -- lambda
]
-- Hex
"e"
`shouldLexTo` [ (1, 1, NumericEntity 101)
]
monospace :: Expectation
monospace =
"@mono@"