@@ -302,8 +302,10 @@ instance Monad Parser where
305+{-# INLINE symbol #-}
305symbol :: Text -> Parser ()
306symbol :: Text -> Parser ()
306symbol sym@(Text.Text tArray tOffset tLen) =
307symbol sym@(Text.Text tArray tOffset tLen) =
308+ let !theory = Symbol sym in
307 Parser $ \(State array offset length indent row col ctx) cok _ _ eerr ->
309 Parser $ \(State array offset length indent row col ctx) cok _ _ eerr ->
308 if tLen <= length && Text.equal tArray tOffset array offset tLen then
310 if tLen <= length && Text.equal tArray tOffset array offset tLen then
@@ -316,7 +318,7 @@ symbol sym@(Text.Text tArray tOffset tLen) =
316 cok () newState noError
318 cok () newState noError
319− eerr (expect row col ctx (Symbol sym))
321+ eerr (expect row col ctx theory)
322moveCursor :: Text.Array -> Int -> Int -> Int -> Int -> (# Int, Int #)
324moveCursor :: Text.Array -> Int -> Int -> Int -> Int -> (# Int, Int #)
@@ -738,7 +740,7 @@ eatMultiCommentHelp array offset length row col openComments =
739docComment :: Parser Text
741docComment :: Parser Text
740docComment =
742docComment =
741− do symbol "{-|"
743+ do docCommentOpen
742 Parser $ \(State array offset length indent row col ctx) cok cerr _ _ ->
744 Parser $ \(State array offset length indent row col ctx) cok cerr _ _ ->
743 case eatMultiCommentHelp array offset length row col 1 of
745 case eatMultiCommentHelp array offset length row col 1 of
744 Left err ->
746 Left err ->
@@ -751,6 +753,12 @@ docComment =
756+{-# NOINLINE docCommentOpen #-}
757+docCommentOpen :: Parser ()
754chompUntilDocs :: Parser Bool
762chompUntilDocs :: Parser Bool
755chompUntilDocs =
763chompUntilDocs =
756 Parser $ \(State array offset length indent row col ctx) cok _ _ _ ->
764 Parser $ \(State array offset length indent row col ctx) cok _ _ _ ->
@@ -1375,7 +1383,7 @@ stepHex word hexNumber =
1376shaderSource :: Parser Text
1384shaderSource :: Parser Text
1377shaderSource =
1385shaderSource =
1378− do symbol "[glsl|"
1386+ do shaderSourceOpen
1379 Parser $ \(State array offset length indent row col ctx) cok cerr _ _ ->
1387 Parser $ \(State array offset length indent row col ctx) cok cerr _ _ ->
1380 case eatShader array offset length row col of
1388 case eatShader array offset length row col of
1381 Nothing ->
1389 Nothing ->
@@ -1390,6 +1398,12 @@ shaderSource =
1390 cok (copyText array offset size) newState noError
1398 cok (copyText array offset size) newState noError
1401+{-# NOINLINE shaderSourceOpen #-}
1402+shaderSourceOpen :: Parser ()
1393eatShader :: Text.Array -> Int -> Int -> Int -> Int -> Maybe (Int, Int, Int)
1407eatShader :: Text.Array -> Int -> Int -> Int -> Int -> Maybe (Int, Int, Int)
1394eatShader array offset length row col =
1408eatShader array offset length row col =
1395 if length < 2 then
1409 if length < 2 then