diff --git a/src/Lexer.hs b/src/Lexer.hs index 436ebfe..c2a7f01 100644 --- a/src/Lexer.hs +++ b/src/Lexer.hs @@ -51,8 +51,8 @@ data Token | ParenClose | BracketOpen | BracketClose - | MathsParenOpen - | MathsParenClose + | MathInlineOpen + | MathInlineClose | MathsBracketOpen | MathsBracketClose | NumericEntity Int @@ -86,7 +86,7 @@ lexText = go choice $ Parsec.try <$> [ mathsBracket - , mathsParens + , mathInline , escape -- maths go before escape to avoid mismatch , headers , newlineToken @@ -245,8 +245,8 @@ labeledLink = do mathsBracket :: Lexer mathsBracket = delimited "\\[" "\\]" MathsBracketOpen MathsBracketClose -mathsParens :: Lexer -mathsParens = delimited "\\(" "\\)" MathsParenOpen MathsParenClose +mathInline :: Lexer +mathInline = delimited "\\(" "\\)" MathInlineOpen MathInlineClose birdTrack :: Lexer birdTrack = delimitedNoTrailing ">> " eol BirdTrack diff --git a/test/Spec.hs b/test/Spec.hs index a09489e..21f5d36 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -98,9 +98,9 @@ maths = do , (1, 12, MathsBracketClose) ] "\\(other maths\\)" - `shouldLexTo` [ (1, 1, MathsParenOpen) + `shouldLexTo` [ (1, 1, MathInlineOpen) , (1, 3, Token "other maths") - , (1, 14, MathsParenClose) + , (1, 14, MathInlineClose) ] escaping :: Expectation