summaryrefslogtreecommitdiff
path: root/source/Syntax/Token.hs
diff options
context:
space:
mode:
authoradelon <22380201+adelon@users.noreply.github.com>2024-04-01 22:40:33 +0200
committeradelon <22380201+adelon@users.noreply.github.com>2024-04-01 22:40:33 +0200
commit7a80b75aeaf7fd6e8828b843fa58664f11451833 (patch)
treef0e4df46ebd14b4178c06961e6b9748798eaaf81 /source/Syntax/Token.hs
parenteae0db671c00f8203c1a61b7a87a00f4e22363a3 (diff)
Allow numbers in markers (from the second char)
Diffstat (limited to 'source/Syntax/Token.hs')
-rw-r--r--source/Syntax/Token.hs7
1 files changed, 5 insertions, 2 deletions
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{".