Compare commits

..

No commits in common. "bd07547e26b167f1907cbcb66ea39e9d6fb346ec" and "f3b3b08919662479df126597446738e0fb92ef6d" have entirely different histories.

2 changed files with 14 additions and 14 deletions

View file

@ -51,10 +51,10 @@ data Token
| ParenClose | ParenClose
| BracketOpen | BracketOpen
| BracketClose | BracketClose
| MathInlineOpen | MathsParenOpen
| MathInlineClose | MathsParenClose
| MathsMultilineOpen | MathsBracketOpen
| MathsMultilineClose | MathsBracketClose
| NumericEntity Int | NumericEntity Int
| Module Text | Module Text
| QuoteOpen | QuoteOpen
@ -85,8 +85,8 @@ lexText = go
toks <- toks <-
choice $ choice $
Parsec.try Parsec.try
<$> [ mathMultiline <$> [ mathsBracket
, mathInline , mathsParens
, escape -- maths go before escape to avoid mismatch , escape -- maths go before escape to avoid mismatch
, headers , headers
, newlineToken , newlineToken
@ -242,11 +242,11 @@ labeledLink = do
, (pos8, LabeledLinkClose) , (pos8, LabeledLinkClose)
] ]
mathMultiline :: Lexer mathsBracket :: Lexer
mathMultiline = delimited "\\[" "\\]" MathsMultilineOpen MathsMultilineClose mathsBracket = delimited "\\[" "\\]" MathsBracketOpen MathsBracketClose
mathInline :: Lexer mathsParens :: Lexer
mathInline = delimited "\\(" "\\)" MathInlineOpen MathInlineClose mathsParens = delimited "\\(" "\\)" MathsParenOpen MathsParenClose
birdTrack :: Lexer birdTrack :: Lexer
birdTrack = delimitedNoTrailing ">> " eol BirdTrack birdTrack = delimitedNoTrailing ">> " eol BirdTrack

View file

@ -93,14 +93,14 @@ anchors =
maths :: IO () maths :: IO ()
maths = do maths = do
"\\[some math\\]" "\\[some math\\]"
`shouldLexTo` [ (1, 1, MathsMultilineOpen) `shouldLexTo` [ (1, 1, MathsBracketOpen)
, (1, 3, Token "some math") , (1, 3, Token "some math")
, (1, 12, MathsMultilineClose) , (1, 12, MathsBracketClose)
] ]
"\\(other maths\\)" "\\(other maths\\)"
`shouldLexTo` [ (1, 1, MathInlineOpen) `shouldLexTo` [ (1, 1, MathsParenOpen)
, (1, 3, Token "other maths") , (1, 3, Token "other maths")
, (1, 14, MathInlineClose) , (1, 14, MathsParenClose)
] ]
escaping :: Expectation escaping :: Expectation