ref(lexer): rename MathParen -> MathInline

This commit is contained in:
Primrose 2025-09-24 21:31:26 +08:00
parent f3b3b08919
commit 6ec47dad04
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
2 changed files with 7 additions and 7 deletions

View file

@ -51,8 +51,8 @@ data Token
| ParenClose | ParenClose
| BracketOpen | BracketOpen
| BracketClose | BracketClose
| MathsParenOpen | MathInlineOpen
| MathsParenClose | MathInlineClose
| MathsBracketOpen | MathsBracketOpen
| MathsBracketClose | MathsBracketClose
| NumericEntity Int | NumericEntity Int
@ -86,7 +86,7 @@ lexText = go
choice $ choice $
Parsec.try Parsec.try
<$> [ mathsBracket <$> [ mathsBracket
, mathsParens , mathInline
, escape -- maths go before escape to avoid mismatch , escape -- maths go before escape to avoid mismatch
, headers , headers
, newlineToken , newlineToken
@ -245,8 +245,8 @@ labeledLink = do
mathsBracket :: Lexer mathsBracket :: Lexer
mathsBracket = delimited "\\[" "\\]" MathsBracketOpen MathsBracketClose mathsBracket = delimited "\\[" "\\]" MathsBracketOpen MathsBracketClose
mathsParens :: Lexer mathInline :: Lexer
mathsParens = delimited "\\(" "\\)" MathsParenOpen MathsParenClose mathInline = delimited "\\(" "\\)" MathInlineOpen MathInlineClose
birdTrack :: Lexer birdTrack :: Lexer
birdTrack = delimitedNoTrailing ">> " eol BirdTrack birdTrack = delimitedNoTrailing ">> " eol BirdTrack

View file

@ -98,9 +98,9 @@ maths = do
, (1, 12, MathsBracketClose) , (1, 12, MathsBracketClose)
] ]
"\\(other maths\\)" "\\(other maths\\)"
`shouldLexTo` [ (1, 1, MathsParenOpen) `shouldLexTo` [ (1, 1, MathInlineOpen)
, (1, 3, Token "other maths") , (1, 3, Token "other maths")
, (1, 14, MathsParenClose) , (1, 14, MathInlineClose)
] ]
escaping :: Expectation escaping :: Expectation