From 7a80b75aeaf7fd6e8828b843fa58664f11451833 Mon Sep 17 00:00:00 2001 From: adelon <22380201+adelon@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:40:33 +0200 Subject: Allow numbers in markers (from the second char) --- source/Syntax/Token.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/Syntax/Token.hs') diff --git a/source/Syntax/Token.hs b/source/Syntax/Token.hs index 7a9a42d..1d13693 100644 --- a/source/Syntax/Token.hs +++ b/source/Syntax/Token.hs @@ -27,7 +27,7 @@ import Base hiding (many) import Control.Monad.Combinators import Control.Monad.State.Strict -import Data.Char (isAsciiLower) +import Data.Char (isAsciiLower, isDigit) import Data.List.NonEmpty qualified as NonEmpty import Data.Text qualified as Text import Prettyprinter (Pretty(..)) @@ -392,7 +392,10 @@ ref = lexeme do _ -> Char.char '}' *> pure (Ref ms) marker :: Lexer Text -marker = takeWhile1P Nothing (\x -> isAsciiLower x || x == '_') +marker = do + c <- satisfy isAsciiLower + cs <- takeWhileP Nothing (\x -> isAsciiLower x || isDigit x || x == '_') + pure (Text.cons c cs) -- | Parses the end of an environment. -- Commits only after having seen "\end{". -- cgit v1.2.3