feat(lexer): implement numericEntity lexer (#6)

I did this yesterday actually, I just rebased it.

Reviewed-on: #6
Reviewed-by: elland <igor@elland.me>
Co-authored-by: Léana 江 <leana.jiang+git@icloud.com>
Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
This commit is contained in:
Primrose 2025-09-27 15:10:11 +00:00 committed by elland
parent 08dc87a307
commit 82eb8435ab
2 changed files with 40 additions and 1 deletions

View file

@ -29,6 +29,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
"&#65; &#955;"
`shouldLexTo` [ (1, 1, NumericEntity 65)
, (1, 6, Space)
, (1, 7, NumericEntity 955) -- lambda
]
-- Hex
"&#x65;"
`shouldLexTo` [ (1, 1, NumericEntity 101)
]
monospace :: Expectation
monospace =
"@mono@"