Added maths bracketing

This commit is contained in:
Igor Ranieri 2025-09-21 11:00:22 +02:00
parent 9efc312597
commit 7ef411b134
2 changed files with 48 additions and 12 deletions

View file

@ -17,6 +17,8 @@ main = hspec $ do
describe "Lexer" do
describe "minimal" do
it "handles unicode" unicode
it "escapes" escaping
it "maths" maths
it "space chars" space
it "bare string" someString
it "emphasis" emphatic
@ -35,6 +37,26 @@ main = hspec $ do
-- Tests
------------
maths :: IO ()
maths = do
"\\[some math\\]"
`shouldLexTo` [ (1, 1, MathsBracketOpen)
, (1, 2, Token "some math")
, (1, 13, MathsBracketClose)
]
"\\(other maths\\)"
`shouldLexTo` [ (1, 1, MathsParenOpen)
, (1, 2, Token "other maths")
, (1, 15, MathsParenClose)
]
escaping :: Expectation
escaping =
"\\("
`shouldLexTo` [ (1, 1, Escape)
, (1, 2, Token "(")
]
unicode :: Expectation
unicode =
"ドラゴンクエストの冒険者🐉"