{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Zenacy.HTML.Internal.Lexer
( Lexer(..)
, LexerOptions(..)
, LexerSkip(..)
, lexerNew
, lexerSetRCDATA
, lexerSetRAWTEXT
, lexerSetPLAINTEXT
, lexerSetScriptData
, lexerSkipNextLF
, lexerNext
) where
import Zenacy.HTML.Internal.BS
import Zenacy.HTML.Internal.Buffer
import Zenacy.HTML.Internal.Char
import Zenacy.HTML.Internal.Core
import Zenacy.HTML.Internal.Entity
import Zenacy.HTML.Internal.Token
import Control.Monad
( forM
, forM_
, mapM
, when
)
import Control.Monad.Extra
( whenM
, whenJust
)
import Control.Monad.ST
( ST
)
import Data.STRef
( STRef
, newSTRef
)
import Data.DList
( DList
)
import qualified Data.DList as D
( empty
, snoc
, toList
)
import Data.Map
( Map
)
import qualified Data.Map as Map
( fromList
, lookup
)
import Data.Maybe
( isJust
)
import Data.Word
( Word8
)
import Data.Default
( Default(..)
)
import Data.Vector.Storable.Mutable
( MVector(..)
)
import qualified Data.Vector.Storable.Mutable as U
( new
, length
, read
, write
, grow
)
import Debug.Trace (trace)
data LexerOptions = LexerOptions
{ LexerOptions -> BS
lexerOptionInput :: BS
, LexerOptions -> Bool
lexerOptionLogErrors :: Bool
, LexerOptions -> Bool
lexerOptionIgnoreEntities :: Bool
} deriving (Int -> LexerOptions -> ShowS
[LexerOptions] -> ShowS
LexerOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LexerOptions] -> ShowS
$cshowList :: [LexerOptions] -> ShowS
show :: LexerOptions -> String
$cshow :: LexerOptions -> String
showsPrec :: Int -> LexerOptions -> ShowS
$cshowsPrec :: Int -> LexerOptions -> ShowS
Show)
data LexerSkip
= LexerSkipNone
| LexerSkipLF
deriving (LexerSkip -> LexerSkip -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LexerSkip -> LexerSkip -> Bool
$c/= :: LexerSkip -> LexerSkip -> Bool
== :: LexerSkip -> LexerSkip -> Bool
$c== :: LexerSkip -> LexerSkip -> Bool
Eq, Eq LexerSkip
LexerSkip -> LexerSkip -> Bool
LexerSkip -> LexerSkip -> Ordering
LexerSkip -> LexerSkip -> LexerSkip
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LexerSkip -> LexerSkip -> LexerSkip
$cmin :: LexerSkip -> LexerSkip -> LexerSkip
max :: LexerSkip -> LexerSkip -> LexerSkip
$cmax :: LexerSkip -> LexerSkip -> LexerSkip
>= :: LexerSkip -> LexerSkip -> Bool
$c>= :: LexerSkip -> LexerSkip -> Bool
> :: LexerSkip -> LexerSkip -> Bool
$c> :: LexerSkip -> LexerSkip -> Bool
<= :: LexerSkip -> LexerSkip -> Bool
$c<= :: LexerSkip -> LexerSkip -> Bool
< :: LexerSkip -> LexerSkip -> Bool
$c< :: LexerSkip -> LexerSkip -> Bool
compare :: LexerSkip -> LexerSkip -> Ordering
$ccompare :: LexerSkip -> LexerSkip -> Ordering
Ord, Int -> LexerSkip -> ShowS
[LexerSkip] -> ShowS
LexerSkip -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LexerSkip] -> ShowS
$cshowList :: [LexerSkip] -> ShowS
show :: LexerSkip -> String
$cshow :: LexerSkip -> String
showsPrec :: Int -> LexerSkip -> ShowS
$cshowsPrec :: Int -> LexerSkip -> ShowS
Show)
data Lexer s = Lexer
{ forall s. Lexer s -> BS
lexerData :: BS
, forall s. Lexer s -> Bool
lexerIgnore :: Bool
, forall s. Lexer s -> Bool
lexerLog :: Bool
, forall s. Lexer s -> STRef s Int
lexerOffset :: STRef s Int
, forall s. Lexer s -> STRef s (TokenBuffer s)
lexerToken :: STRef s (TokenBuffer s)
, forall s. Lexer s -> STRef s (Buffer s)
lexerBuffer :: STRef s (Buffer s)
, forall s. Lexer s -> STRef s [Word8]
lexerLast :: STRef s [Word8]
, forall s. Lexer s -> STRef s LexerState
lexerState :: STRef s LexerState
, forall s. Lexer s -> STRef s LexerState
lexerReturn :: STRef s LexerState
, forall s. Lexer s -> STRef s LexerSkip
lexerSkip :: STRef s LexerSkip
, forall s. Lexer s -> STRef s (DList BS)
lexerErrors :: STRef s (DList BS)
, forall s. Lexer s -> STRef s Int
lexerCode :: STRef s Int
}
instance Default LexerOptions where
def :: LexerOptions
def = LexerOptions
{ lexerOptionInput :: BS
lexerOptionInput = BS
bsEmpty
, lexerOptionLogErrors :: Bool
lexerOptionLogErrors = Bool
False
, lexerOptionIgnoreEntities :: Bool
lexerOptionIgnoreEntities = Bool
False
}
data LexerState
= StateData
| StateRCDATA
| StateRAWTEXT
| StateScriptData
| StatePLAINTEXT
| StateTagOpen
| StateEndTagOpen
| StateTagName
| StateRCDATALessThan
| StateRCDATAEndTagOpen
| StateRCDATAEndTagName
| StateRAWTEXTLessThan
| StateRAWTEXTEndTagOpen
| StateRAWTEXTEndTagName
| StateScriptDataLessThan
| StateScriptDataEndTagOpen
| StateScriptDataEndTagName
| StateScriptDataEscapeStart
| StateScriptDataEscapeStartDash
| StateScriptDataEscaped
| StateScriptDataEscapedDash
| StateScriptDataEscapedDashDash
| StateScriptDataEscapedLessThan
| StateScriptDataEscapedEndTagOpen
| StateScriptDataEscapedEndTagName
| StateScriptDataDoubleEscapedStart
| StateScriptDataDoubleEscaped
| StateScriptDataDoubleEscapedDash
| StateScriptDataDoubleEscapedDashDash
| StateScriptDataDoubleEscapedLessThan
| StateScriptDataDoubleEscapeEnd
| StateBeforeAttrName
| StateAttrName
| StateAfterAttrName
| StateBeforeAttrValue
| StateAttrValueDoubleQuoted
| StateAttrValueSingleQuoted
| StateAttrValueUnquoted
| StateAfterAttrValue
| StateSelfClosingStartTag
|
| StateMarkupDeclarationOpen
|
|
|
|
|
|
|
|
|
|
| StateDoctype
| StateBeforeDoctypeName
| StateDoctypeName
| StateAfterDoctypeName
| StateAfterDoctypePublicKeyword
| StateBeforeDoctypePublicId
| StateDoctypePublicIdDoubleQuoted
| StateDoctypePublicIdSingleQuoted
| StateAfterDoctypePublicId
| StateBetweenDoctypePublicAndSystem
| StateAfterDoctypeSystemKeyword
| StateBeforeDoctypeSystemId
| StateDoctypeSystemIdDoubleQuoted
| StateDoctypeSystemIdSingleQuoted
| StateAfterDoctypeSystemId
| StateBogusDoctype
| StateCDATASection
| StateCDATASectionBracket
| StateCDATASectionEnd
| StateCharacterReference
| StateNamedCharacterReference
| StateAmbiguousAmpersand
| StateNumericCharacterReference
| StateHexCharacterReferenceStart
| StateDecimalCharacterReferenceStart
| StateHexCharacterReference
| StateDecimalCharacterReference
| StateNumericCharacterReferenceEnd
deriving (Int -> LexerState -> ShowS
[LexerState] -> ShowS
LexerState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LexerState] -> ShowS
$cshowList :: [LexerState] -> ShowS
show :: LexerState -> String
$cshow :: LexerState -> String
showsPrec :: Int -> LexerState -> ShowS
$cshowsPrec :: Int -> LexerState -> ShowS
Show, LexerState -> LexerState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LexerState -> LexerState -> Bool
$c/= :: LexerState -> LexerState -> Bool
== :: LexerState -> LexerState -> Bool
$c== :: LexerState -> LexerState -> Bool
Eq, Eq LexerState
LexerState -> LexerState -> Bool
LexerState -> LexerState -> Ordering
LexerState -> LexerState -> LexerState
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LexerState -> LexerState -> LexerState
$cmin :: LexerState -> LexerState -> LexerState
max :: LexerState -> LexerState -> LexerState
$cmax :: LexerState -> LexerState -> LexerState
>= :: LexerState -> LexerState -> Bool
$c>= :: LexerState -> LexerState -> Bool
> :: LexerState -> LexerState -> Bool
$c> :: LexerState -> LexerState -> Bool
<= :: LexerState -> LexerState -> Bool
$c<= :: LexerState -> LexerState -> Bool
< :: LexerState -> LexerState -> Bool
$c< :: LexerState -> LexerState -> Bool
compare :: LexerState -> LexerState -> Ordering
$ccompare :: LexerState -> LexerState -> Ordering
Ord)
lexerDispatch :: LexerState -> Lexer s -> ST s ()
lexerDispatch :: forall s. LexerState -> Lexer s -> ST s ()
lexerDispatch = \case
LexerState
StateData ->
forall s. Lexer s -> ST s ()
doData
LexerState
StateRCDATA ->
forall s. Lexer s -> ST s ()
doRCDATA
LexerState
StateRAWTEXT ->
forall s. Lexer s -> ST s ()
doRAWTEXT
LexerState
StateScriptData ->
forall s. Lexer s -> ST s ()
doScriptData
LexerState
StatePLAINTEXT ->
forall s. Lexer s -> ST s ()
doPLAINTEXT
LexerState
StateTagOpen ->
forall s. Lexer s -> ST s ()
doTagOpen
LexerState
StateEndTagOpen ->
forall s. Lexer s -> ST s ()
doEndTagOpen
LexerState
StateTagName ->
forall s. Lexer s -> ST s ()
doTagName
LexerState
StateRCDATALessThan ->
forall s. Lexer s -> ST s ()
doRCDATALessThan
LexerState
StateRCDATAEndTagOpen ->
forall s. Lexer s -> ST s ()
doRCDATAEndTagOpen
LexerState
StateRCDATAEndTagName ->
forall s. Lexer s -> ST s ()
doRCDATAEndTagName
LexerState
StateRAWTEXTLessThan ->
forall s. Lexer s -> ST s ()
doRAWTEXTLessThan
LexerState
StateRAWTEXTEndTagOpen ->
forall s. Lexer s -> ST s ()
doRAWTEXTEndTagOpen
LexerState
StateRAWTEXTEndTagName ->
forall s. Lexer s -> ST s ()
doRAWTEXTEndTagName
LexerState
StateScriptDataLessThan ->
forall s. Lexer s -> ST s ()
doScriptDataLessThan
LexerState
StateScriptDataEndTagOpen ->
forall s. Lexer s -> ST s ()
doScriptDataEndTagOpen
LexerState
StateScriptDataEndTagName ->
forall s. Lexer s -> ST s ()
doScriptDataEndTagName
LexerState
StateScriptDataEscapeStart ->
forall s. Lexer s -> ST s ()
doScriptDataEscapeStart
LexerState
StateScriptDataEscapeStartDash ->
forall s. Lexer s -> ST s ()
doScriptDataEscapeStartDash
LexerState
StateScriptDataEscaped ->
forall s. Lexer s -> ST s ()
doScriptDataEscaped
LexerState
StateScriptDataEscapedDash ->
forall s. Lexer s -> ST s ()
doScriptDataEscapedDash
LexerState
StateScriptDataEscapedDashDash ->
forall s. Lexer s -> ST s ()
doScriptDataEscapedDashDash
LexerState
StateScriptDataEscapedLessThan ->
forall s. Lexer s -> ST s ()
doScriptDataEscapedLessThan
LexerState
StateScriptDataEscapedEndTagOpen ->
forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagOpen
LexerState
StateScriptDataEscapedEndTagName ->
forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagName
LexerState
StateScriptDataDoubleEscapedStart ->
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedStart
LexerState
StateScriptDataDoubleEscaped ->
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscaped
LexerState
StateScriptDataDoubleEscapedDash ->
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedDash
LexerState
StateScriptDataDoubleEscapedDashDash ->
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedDashDash
LexerState
StateScriptDataDoubleEscapedLessThan ->
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedLessThan
LexerState
StateScriptDataDoubleEscapeEnd ->
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapeEnd
LexerState
StateBeforeAttrName ->
forall s. Lexer s -> ST s ()
doBeforeAttrName
LexerState
StateAttrName ->
forall s. Lexer s -> ST s ()
doAttrName
LexerState
StateAfterAttrName ->
forall s. Lexer s -> ST s ()
doAfterAttrName
LexerState
StateBeforeAttrValue ->
forall s. Lexer s -> ST s ()
doBeforeAttrValue
LexerState
StateAttrValueDoubleQuoted ->
forall s. Lexer s -> ST s ()
doAttrValueDoubleQuoted
LexerState
StateAttrValueSingleQuoted ->
forall s. Lexer s -> ST s ()
doAttrValueSingleQuoted
LexerState
StateAttrValueUnquoted ->
forall s. Lexer s -> ST s ()
doAttrValueUnquoted
LexerState
StateAfterAttrValue ->
forall s. Lexer s -> ST s ()
doAfterAttrValue
LexerState
StateSelfClosingStartTag ->
forall s. Lexer s -> ST s ()
doSelfClosingStartTag
LexerState
StateBogusComment ->
forall s. Lexer s -> ST s ()
doBogusComment
LexerState
StateMarkupDeclarationOpen ->
forall s. Lexer s -> ST s ()
doMarkupDeclarationOpen
LexerState
StateCommentStart ->
forall s. Lexer s -> ST s ()
doCommentStart
LexerState
StateCommentStartDash ->
forall s. Lexer s -> ST s ()
doCommentStartDash
LexerState
StateComment ->
forall s. Lexer s -> ST s ()
doComment
LexerState
StateCommentLessThan ->
forall s. Lexer s -> ST s ()
doCommentLessThan
LexerState
StateCommentLessThanBang ->
forall s. Lexer s -> ST s ()
doCommentLessThanBang
LexerState
StateCommentLessThanBangDash ->
forall s. Lexer s -> ST s ()
doCommentLessThanBangDash
LexerState
StateCommentLessThanBangDashDash ->
forall s. Lexer s -> ST s ()
doCommentLessThanBangDashDash
LexerState
StateCommentEndDash ->
forall s. Lexer s -> ST s ()
doCommentEndDash
LexerState
StateCommentEnd ->
forall s. Lexer s -> ST s ()
doCommentEnd
LexerState
StateCommentEndBang ->
forall s. Lexer s -> ST s ()
doCommentEndBang
LexerState
StateDoctype ->
forall s. Lexer s -> ST s ()
doDoctype
LexerState
StateBeforeDoctypeName ->
forall s. Lexer s -> ST s ()
doBeforeDoctypeName
LexerState
StateDoctypeName ->
forall s. Lexer s -> ST s ()
doDoctypeName
LexerState
StateAfterDoctypeName ->
forall s. Lexer s -> ST s ()
doAfterDoctypeName
LexerState
StateAfterDoctypePublicKeyword ->
forall s. Lexer s -> ST s ()
doAfterDoctypePublicKeyword
LexerState
StateBeforeDoctypePublicId ->
forall s. Lexer s -> ST s ()
doBeforeDoctypePublicId
LexerState
StateDoctypePublicIdDoubleQuoted ->
forall s. Lexer s -> ST s ()
doDoctypePublicIdDoubleQuoted
LexerState
StateDoctypePublicIdSingleQuoted ->
forall s. Lexer s -> ST s ()
doDoctypePublicIdSingleQuoted
LexerState
StateAfterDoctypePublicId ->
forall s. Lexer s -> ST s ()
doAfterDoctypePublicId
LexerState
StateBetweenDoctypePublicAndSystem ->
forall s. Lexer s -> ST s ()
doBetweenDoctypePublicAndSystem
LexerState
StateAfterDoctypeSystemKeyword ->
forall s. Lexer s -> ST s ()
doAfterDoctypeSystemKeyword
LexerState
StateBeforeDoctypeSystemId ->
forall s. Lexer s -> ST s ()
doBeforeDoctypeSystemId
LexerState
StateDoctypeSystemIdDoubleQuoted ->
forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted
LexerState
StateDoctypeSystemIdSingleQuoted ->
forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted
LexerState
StateAfterDoctypeSystemId ->
forall s. Lexer s -> ST s ()
doAfterDoctypeSystemId
LexerState
StateBogusDoctype ->
forall s. Lexer s -> ST s ()
doBogusDoctype
LexerState
StateCDATASection ->
forall s. Lexer s -> ST s ()
doCDATASection
LexerState
StateCDATASectionBracket ->
forall s. Lexer s -> ST s ()
doCDATASectionBracket
LexerState
StateCDATASectionEnd ->
forall s. Lexer s -> ST s ()
doCDATASectionEnd
LexerState
StateCharacterReference ->
forall s. Lexer s -> ST s ()
doCharacterReference
LexerState
StateNamedCharacterReference ->
forall s. Lexer s -> ST s ()
doNamedCharacterReference
LexerState
StateAmbiguousAmpersand ->
forall s. Lexer s -> ST s ()
doAmbiguousAmpersand
LexerState
StateNumericCharacterReference ->
forall s. Lexer s -> ST s ()
doNumericCharacterReference
LexerState
StateHexCharacterReferenceStart ->
forall s. Lexer s -> ST s ()
doHexCharacterReferenceStart
LexerState
StateDecimalCharacterReferenceStart ->
forall s. Lexer s -> ST s ()
doDecimalCharacterReferenceStart
LexerState
StateHexCharacterReference ->
forall s. Lexer s -> ST s ()
doHexCharacterReference
LexerState
StateDecimalCharacterReference ->
forall s. Lexer s -> ST s ()
doDecimalCharacterReference
LexerState
StateNumericCharacterReferenceEnd ->
forall s. Lexer s -> ST s ()
doNumericCharacterReferenceEnd
lexerNew :: LexerOptions -> ST s (Either BS (Lexer s))
lexerNew :: forall s. LexerOptions -> ST s (Either BS (Lexer s))
lexerNew o :: LexerOptions
o@LexerOptions{Bool
BS
lexerOptionIgnoreEntities :: Bool
lexerOptionLogErrors :: Bool
lexerOptionInput :: BS
lexerOptionIgnoreEntities :: LexerOptions -> Bool
lexerOptionLogErrors :: LexerOptions -> Bool
lexerOptionInput :: LexerOptions -> BS
..}
| Just Int
i <- Word8 -> BS -> Maybe Int
bsElemIndex Word8
0 BS
lexerOptionInput =
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a b. a -> Either a b
Left forall a b. (a -> b) -> a -> b
$ [BS] -> BS
bsConcat [ BS
"input contains null at ", String -> BS
bcPack forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> String
show Int
i ]
| Bool
otherwise =
forall a b. b -> Either a b
Right forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall s. LexerOptions -> ST s (Lexer s)
lexerMake LexerOptions
o
lexerMake :: LexerOptions -> ST s (Lexer s)
lexerMake :: forall s. LexerOptions -> ST s (Lexer s)
lexerMake LexerOptions{Bool
BS
lexerOptionIgnoreEntities :: Bool
lexerOptionLogErrors :: Bool
lexerOptionInput :: BS
lexerOptionIgnoreEntities :: LexerOptions -> Bool
lexerOptionLogErrors :: LexerOptions -> Bool
lexerOptionInput :: LexerOptions -> BS
..} = do
STRef s Int
offset <- forall a s. a -> ST s (STRef s a)
newSTRef Int
0
STRef s LexerState
state <- forall a s. a -> ST s (STRef s a)
newSTRef LexerState
StateData
STRef s LexerState
ret <- forall a s. a -> ST s (STRef s a)
newSTRef LexerState
StateData
STRef s (TokenBuffer s)
token <- forall s. ST s (STRef s (TokenBuffer s))
tokenBuffer
STRef s (Buffer s)
buffer <- forall s. ST s (STRef s (Buffer s))
bufferNew
STRef s [Word8]
last <- forall a s. a -> ST s (STRef s a)
newSTRef []
STRef s LexerSkip
skip <- forall a s. a -> ST s (STRef s a)
newSTRef LexerSkip
LexerSkipNone
STRef s (DList BS)
errors <- forall a s. a -> ST s (STRef s a)
newSTRef forall a. DList a
D.empty
STRef s Int
code <- forall a s. a -> ST s (STRef s a)
newSTRef Int
0
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Lexer
{ lexerData :: BS
lexerData = BS
lexerOptionInput
, lexerIgnore :: Bool
lexerIgnore = Bool
lexerOptionIgnoreEntities
, lexerLog :: Bool
lexerLog = Bool
lexerOptionLogErrors
, lexerOffset :: STRef s Int
lexerOffset = STRef s Int
offset
, lexerToken :: STRef s (TokenBuffer s)
lexerToken = STRef s (TokenBuffer s)
token
, lexerBuffer :: STRef s (Buffer s)
lexerBuffer = STRef s (Buffer s)
buffer
, lexerLast :: STRef s [Word8]
lexerLast = STRef s [Word8]
last
, lexerState :: STRef s LexerState
lexerState = STRef s LexerState
state
, lexerReturn :: STRef s LexerState
lexerReturn = STRef s LexerState
ret
, lexerSkip :: STRef s LexerSkip
lexerSkip = STRef s LexerSkip
skip
, lexerErrors :: STRef s (DList BS)
lexerErrors = STRef s (DList BS)
errors
, lexerCode :: STRef s Int
lexerCode = STRef s Int
code
}
lexerSetRCDATA :: Lexer s -> ST s ()
lexerSetRCDATA :: forall s. Lexer s -> ST s ()
lexerSetRCDATA Lexer{Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerState
lexerState LexerState
StateRCDATA
lexerSetRAWTEXT :: Lexer s -> ST s ()
lexerSetRAWTEXT :: forall s. Lexer s -> ST s ()
lexerSetRAWTEXT Lexer{Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerState
lexerState LexerState
StateRAWTEXT
lexerSetPLAINTEXT :: Lexer s -> ST s ()
lexerSetPLAINTEXT :: forall s. Lexer s -> ST s ()
lexerSetPLAINTEXT Lexer{Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerState
lexerState LexerState
StatePLAINTEXT
lexerSetScriptData :: Lexer s -> ST s ()
lexerSetScriptData :: forall s. Lexer s -> ST s ()
lexerSetScriptData Lexer{Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerState
lexerState LexerState
StateScriptData
lexerSkipNextLF :: Lexer s -> ST s ()
lexerSkipNextLF :: forall s. Lexer s -> ST s ()
lexerSkipNextLF Lexer{Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerSkip
lexerSkip LexerSkip
LexerSkipLF
lexerNext :: Lexer s -> ST s Token
lexerNext :: forall s. Lexer s -> ST s Token
lexerNext x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} =
ST s Token
skip
where
skip :: ST s Token
skip = do
Token
t <- ST s Token
next
case Token
t of
TChar Word8
0x10 ->
forall s a. STRef s a -> ST s a
rref STRef s LexerSkip
lexerSkip forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
LexerSkip
LexerSkipLF ->
forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerSkip
lexerSkip LexerSkip
LexerSkipNone forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ST s Token
skip
LexerSkip
LexerSkipNone ->
forall (f :: * -> *) a. Applicative f => a -> f a
pure Token
t
Token
_otherwise ->
forall (f :: * -> *) a. Applicative f => a -> f a
pure Token
t
next :: ST s Token
next = do
Int
i <- forall s. STRef s (TokenBuffer s) -> ST s Int
tokenNext STRef s (TokenBuffer s)
lexerToken
if Int
i forall a. Eq a => a -> a -> Bool
== Int
0
then do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenReset STRef s (TokenBuffer s)
lexerToken
LexerState
s <- forall s a. STRef s a -> ST s a
rref STRef s LexerState
lexerState
forall s. LexerState -> Lexer s -> ST s ()
lexerDispatch LexerState
s Lexer s
x
Int
i <- forall s. STRef s (TokenBuffer s) -> ST s Int
tokenFirst STRef s (TokenBuffer s)
lexerToken
if Int
i forall a. Eq a => a -> a -> Bool
== Int
0
then forall (f :: * -> *) a. Applicative f => a -> f a
pure Token
TEOF
else forall s. Int -> STRef s (TokenBuffer s) -> ST s Token
tokenPack Int
i STRef s (TokenBuffer s)
lexerToken
else do
forall s. Int -> STRef s (TokenBuffer s) -> ST s Token
tokenPack Int
i STRef s (TokenBuffer s)
lexerToken
nextWord :: Lexer s -> ST s Word8
nextWord :: forall s. Lexer s -> ST s Word8
nextWord Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int
offset <- forall s a. STRef s a -> ST s a
rref STRef s Int
lexerOffset
if | Int
offset forall a. Ord a => a -> a -> Bool
< BS -> Int
bsLen BS
lexerData -> do
forall s a. STRef s a -> a -> ST s ()
wref STRef s Int
lexerOffset (Int
offset forall a. Num a => a -> a -> a
+ Int
1)
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ BS -> Int -> Word8
bsIndex BS
lexerData Int
offset
| Bool
otherwise ->
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word8
chrEOF
peekWord :: Lexer s -> ST s Word8
peekWord :: forall s. Lexer s -> ST s Word8
peekWord Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int
offset <- forall s a. STRef s a -> ST s a
rref STRef s Int
lexerOffset
if | Int
offset forall a. Ord a => a -> a -> Bool
< BS -> Int
bsLen BS
lexerData ->
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ BS -> Int -> Word8
bsIndex BS
lexerData Int
offset
| Bool
otherwise ->
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word8
chrEOF
backWord :: Lexer s -> ST s ()
backWord :: forall s. Lexer s -> ST s ()
backWord Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s Int
lexerOffset (forall a. Num a => a -> a -> a
subtract Int
1)
skipWord :: Lexer s -> Int -> ST s ()
skipWord :: forall s. Lexer s -> Int -> ST s ()
skipWord Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} Int
n = forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s Int
lexerOffset (forall a. Num a => a -> a -> a
+Int
n)
dataIndexer :: Lexer s -> ST s (Int -> Word8)
dataIndexer :: forall s. Lexer s -> ST s (Int -> Word8)
dataIndexer Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int
offset <- forall s a. STRef s a -> ST s a
rref STRef s Int
lexerOffset
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ \Int
i -> BS -> Int -> Word8
bsIndex BS
lexerData (Int
offset forall a. Num a => a -> a -> a
+ Int
i)
dataRemain :: Lexer s -> ST s Int
dataRemain :: forall s. Lexer s -> ST s Int
dataRemain Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int
offset <- forall s a. STRef s a -> ST s a
rref STRef s Int
lexerOffset
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ BS -> Int
bsLen BS
lexerData forall a. Num a => a -> a -> a
- Int
offset
emit :: Lexer s -> ST s ()
emit :: forall s. Lexer s -> ST s ()
emit Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
forall s. STRef s (TokenBuffer s) -> ST s Int
tokenTail STRef s (TokenBuffer s)
lexerToken forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Int -> STRef s (TokenBuffer s) -> ST s (Maybe [Word8])
tokenTagStartName STRef s (TokenBuffer s)
lexerToken forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Just [Word8]
a -> forall s a. STRef s a -> a -> ST s ()
wref STRef s [Word8]
lexerLast [Word8]
a
Maybe [Word8]
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
emitChar :: Lexer s -> Word8 -> ST s ()
emitChar :: forall s. Lexer s -> Word8 -> ST s ()
emitChar x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} Word8
w = do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
w STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
emitBuffer :: Lexer s -> ST s ()
emitBuffer :: forall s. Lexer s -> ST s ()
emitBuffer x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
forall s. (Word8 -> ST s ()) -> STRef s (Buffer s) -> ST s ()
bufferApply (forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x) STRef s (Buffer s)
lexerBuffer
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
state :: Lexer s -> LexerState -> ST s ()
state :: forall s. Lexer s -> LexerState -> ST s ()
state Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerState
lexerState
returnSet :: Lexer s -> LexerState -> ST s ()
returnSet :: forall s. Lexer s -> LexerState -> ST s ()
returnSet x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> a -> ST s ()
wref STRef s LexerState
lexerReturn
returnGet :: Lexer s -> ST s LexerState
returnGet :: forall s. Lexer s -> ST s LexerState
returnGet x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = forall s a. STRef s a -> ST s a
rref STRef s LexerState
lexerReturn
returnState :: Lexer s -> ST s ()
returnState :: forall s. Lexer s -> ST s ()
returnState Lexer s
x = forall s. Lexer s -> ST s LexerState
returnGet Lexer s
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. LexerState -> Lexer s -> ST s ()
lexerDispatch Lexer s
x
parseError :: Lexer s -> BS -> ST s ()
parseError :: forall s. Lexer s -> BS -> ST s ()
parseError x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} =
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
lexerLog forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s (DList BS)
lexerErrors forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a. DList a -> a -> DList a
D.snoc)
appropriateEndTag :: Lexer s -> ST s Bool
appropriateEndTag :: forall s. Lexer s -> ST s Bool
appropriateEndTag x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
forall s. STRef s (TokenBuffer s) -> ST s Int
tokenTail STRef s (TokenBuffer s)
lexerToken forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Int -> STRef s (TokenBuffer s) -> ST s (Maybe [Word8])
tokenTagEndName STRef s (TokenBuffer s)
lexerToken forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Just [Word8]
a -> (forall a. Eq a => a -> a -> Bool
==[Word8]
a) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall s a. STRef s a -> ST s a
rref STRef s [Word8]
lexerLast
Maybe [Word8]
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
consumingAttibute :: Lexer s -> ST s Bool
consumingAttibute :: forall s. Lexer s -> ST s Bool
consumingAttibute x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
LexerState
a <- forall s. Lexer s -> ST s LexerState
returnGet Lexer s
x
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (forall a. Eq a => a -> a -> Bool
==LexerState
a)
[ LexerState
StateAttrValueDoubleQuoted
, LexerState
StateAttrValueSingleQuoted
, LexerState
StateAttrValueUnquoted
]
flushCodePoints :: Lexer s -> ST s ()
flushCodePoints :: forall s. Lexer s -> ST s ()
flushCodePoints x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Bool
a <- forall s. Lexer s -> ST s Bool
consumingAttibute Lexer s
x
if | Bool
a -> do
forall s. (Word8 -> ST s ()) -> STRef s (Buffer s) -> ST s ()
bufferApply (forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrValAppend STRef s (TokenBuffer s)
lexerToken) STRef s (Buffer s)
lexerBuffer
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
emitBuffer Lexer s
x
doData :: Lexer s -> ST s ()
doData :: forall s. Lexer s -> ST s ()
doData x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrAmpersand -> do
forall s. Lexer s -> LexerState -> ST s ()
returnSet Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
doCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doTagOpen Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doData Lexer s
x
doRCDATA :: Lexer s -> ST s ()
doRCDATA :: forall s. Lexer s -> ST s ()
doRCDATA x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrAmpersand -> do
forall s. Lexer s -> LexerState -> ST s ()
returnSet Lexer s
x LexerState
StateRCDATA
forall s. Lexer s -> ST s ()
doCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doRCDATALessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doRCDATA Lexer s
x
doRAWTEXT :: Lexer s -> ST s ()
doRAWTEXT :: forall s. Lexer s -> ST s ()
doRAWTEXT x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doRAWTEXTLessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doRAWTEXT Lexer s
x
doScriptData :: Lexer s -> ST s ()
doScriptData :: forall s. Lexer s -> ST s ()
doScriptData x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doScriptDataLessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
doPLAINTEXT :: Lexer s -> ST s ()
doPLAINTEXT :: forall s. Lexer s -> ST s ()
doPLAINTEXT x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doPLAINTEXT Lexer s
x
doTagOpen :: Lexer s -> ST s ()
doTagOpen :: forall s. Lexer s -> ST s ()
doTagOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrExclamation -> do
forall s. Lexer s -> ST s ()
doMarkupDeclarationOpen Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. Lexer s -> ST s ()
doEndTagOpen Lexer s
x
| Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagStartInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doTagName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuestion -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unexpected-question-mark-instead-of-tag-name"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenCommentInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doBogusComment Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-before-tag-name"
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"invalid-first-character-of-tag-name"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doData Lexer s
x
doEndTagOpen :: Lexer s -> ST s ()
doEndTagOpen :: forall s. Lexer s -> ST s ()
doEndTagOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagEndInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doTagName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-end-tag-name"
forall s. Lexer s -> ST s ()
doData Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-before-tag-name"
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrSolidus STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"invalid-first-character-of-tag-name"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenCommentInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doBogusComment Lexer s
x
doTagName :: Lexer s -> ST s ()
doTagName :: forall s. Lexer s -> ST s ()
doTagName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doTagName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doTagName Lexer s
x
doRCDATALessThan :: Lexer s -> ST s ()
doRCDATALessThan :: forall s. Lexer s -> ST s ()
doRCDATALessThan x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doRCDATAEndTagOpen Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRCDATA Lexer s
x
doRCDATAEndTagOpen :: Lexer s -> ST s ()
doRCDATAEndTagOpen :: forall s. Lexer s -> ST s ()
doRCDATAEndTagOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagEndInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRCDATAEndTagName Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrSolidus STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRCDATA Lexer s
x
doRCDATAEndTagName :: Lexer s -> ST s ()
doRCDATAEndTagName :: forall s. Lexer s -> ST s ()
doRCDATAEndTagName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
Bool
a <- forall s. Lexer s -> ST s Bool
appropriateEndTag Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
if Bool
a
then do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
else do
ST s ()
anythingElse
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doRCDATAEndTagName Lexer s
x
| Word8 -> Bool
chrASCIILowerAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doRCDATAEndTagName Lexer s
x
| Bool
otherwise -> do
ST s ()
anythingElse
where
anythingElse :: ST s ()
anythingElse = do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDrop STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
emitBuffer Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRCDATA Lexer s
x
doRAWTEXTLessThan :: Lexer s -> ST s ()
doRAWTEXTLessThan :: forall s. Lexer s -> ST s ()
doRAWTEXTLessThan x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doRAWTEXTEndTagOpen Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRAWTEXT Lexer s
x
doRAWTEXTEndTagOpen :: Lexer s -> ST s ()
doRAWTEXTEndTagOpen :: forall s. Lexer s -> ST s ()
doRAWTEXTEndTagOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagEndInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRAWTEXTEndTagName Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRAWTEXT Lexer s
x
doRAWTEXTEndTagName :: Lexer s -> ST s ()
doRAWTEXTEndTagName :: forall s. Lexer s -> ST s ()
doRAWTEXTEndTagName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
Bool
a <- forall s. Lexer s -> ST s Bool
appropriateEndTag Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
if Bool
a
then do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
else do
ST s ()
anythingElse
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doRAWTEXTEndTagName Lexer s
x
| Word8 -> Bool
chrASCIILowerAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doRAWTEXTEndTagName Lexer s
x
| Bool
otherwise -> do
ST s ()
anythingElse
where
anythingElse :: ST s ()
anythingElse = do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDrop STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
emitBuffer Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doRAWTEXT Lexer s
x
doScriptDataLessThan :: Lexer s -> ST s ()
doScriptDataLessThan :: forall s. Lexer s -> ST s ()
doScriptDataLessThan x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doScriptDataEndTagOpen Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrExclamation -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrExclamation STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doScriptDataEscapeStart Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrLess STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
doScriptDataEndTagOpen :: Lexer s -> ST s ()
doScriptDataEndTagOpen :: forall s. Lexer s -> ST s ()
doScriptDataEndTagOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagEndInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataEndTagName Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
doScriptDataEndTagName :: Lexer s -> ST s ()
doScriptDataEndTagName :: forall s. Lexer s -> ST s ()
doScriptDataEndTagName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
Bool
a <- forall s. Lexer s -> ST s Bool
appropriateEndTag Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
if Bool
a
then do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
else do
ST s ()
anythingElse
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doScriptDataEndTagName Lexer s
x
| Word8 -> Bool
chrASCIILowerAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doScriptDataEndTagName Lexer s
x
| Bool
otherwise -> do
ST s ()
anythingElse
where
anythingElse :: ST s ()
anythingElse = do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDrop STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
emitBuffer Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
doScriptDataEscapeStart :: Lexer s -> ST s ()
doScriptDataEscapeStart :: forall s. Lexer s -> ST s ()
doScriptDataEscapeStart x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrHyphen
forall s. Lexer s -> ST s ()
doScriptDataEscapeStartDash Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
doScriptDataEscapeStartDash :: Lexer s -> ST s ()
doScriptDataEscapeStartDash :: forall s. Lexer s -> ST s ()
doScriptDataEscapeStartDash x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrHyphen
forall s. Lexer s -> ST s ()
doScriptDataEscapedDashDash Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
doScriptDataEscaped :: Lexer s -> ST s ()
doScriptDataEscaped :: forall s. Lexer s -> ST s ()
doScriptDataEscaped x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrHyphen
forall s. Lexer s -> ST s ()
doScriptDataEscapedDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doScriptDataEscapedLessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-script-html-comment-like-text"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
doScriptDataEscapedDash :: Lexer s -> ST s ()
doScriptDataEscapedDash :: forall s. Lexer s -> ST s ()
doScriptDataEscapedDash x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrHyphen
forall s. Lexer s -> ST s ()
doScriptDataEscapedDashDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doScriptDataEscapedLessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-script-html-comment-like-text"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
doScriptDataEscapedDashDash :: Lexer s -> ST s ()
doScriptDataEscapedDashDash :: forall s. Lexer s -> ST s ()
doScriptDataEscapedDashDash x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataEscapedDashDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> ST s ()
doScriptDataEscapedLessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptData Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-script-html-comment-like-text"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
doScriptDataEscapedLessThan :: Lexer s -> ST s ()
doScriptDataEscapedLessThan :: forall s. Lexer s -> ST s ()
doScriptDataEscapedLessThan x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagOpen Lexer s
x
| Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedStart Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
doScriptDataEscapedEndTagOpen :: Lexer s -> ST s ()
doScriptDataEscapedEndTagOpen :: forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagEndInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagName Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
doScriptDataEscapedEndTagName :: Lexer s -> ST s ()
doScriptDataEscapedEndTagName :: forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
Bool
a <- forall s. Lexer s -> ST s Bool
appropriateEndTag Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
if Bool
a
then do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
else do
ST s ()
anythingElse
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
if Bool
a
then do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
else do
ST s ()
anythingElse
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagName Lexer s
x
| Word8 -> Bool
chrASCIILowerAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenTagNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doScriptDataEscapedEndTagName Lexer s
x
| Bool
otherwise -> do
ST s ()
anythingElse
where
anythingElse :: ST s ()
anythingElse = do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDrop STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrLess
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrSolidus
forall s. Lexer s -> ST s ()
emitBuffer Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataEscaped
forall s. Lexer s -> ST s ()
emit Lexer s
x
doScriptDataDoubleEscapedStart :: Lexer s -> ST s ()
doScriptDataDoubleEscapedStart :: forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedStart x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. [Word8] -> STRef s (Buffer s) -> ST s Bool
bufferContains (BS -> [Word8]
bsUnpack BS
"script") STRef s (Buffer s)
lexerBuffer forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
True -> do
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscaped Lexer s
x
Bool
False -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataEscaped
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (Buffer s)
lexerBuffer
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedStart
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8 -> Bool
chrASCIILowerAlpha Word8
c -> do
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedStart
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
doScriptDataDoubleEscaped :: Lexer s -> ST s ()
doScriptDataDoubleEscaped :: forall s. Lexer s -> ST s ()
doScriptDataDoubleEscaped x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedDash
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedLessThan
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-script-html-comment-like-text"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
doScriptDataDoubleEscapedDash :: Lexer s -> ST s ()
doScriptDataDoubleEscapedDash :: forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedDash x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedDashDash
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedLessThan
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-script-html-comment-like-text"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscaped
forall s. Lexer s -> ST s ()
emit Lexer s
x
doScriptDataDoubleEscapedDashDash :: Lexer s -> ST s ()
doScriptDataDoubleEscapedDashDash :: forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedDashDash x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedDashDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapedLessThan
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-script-html-comment-like-text"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscaped
forall s. Lexer s -> ST s ()
emit Lexer s
x
doScriptDataDoubleEscapedLessThan :: Lexer s -> ST s ()
doScriptDataDoubleEscapedLessThan :: forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapedLessThan x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscapeEnd
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscaped Lexer s
x
doScriptDataDoubleEscapeEnd :: Lexer s -> ST s ()
doScriptDataDoubleEscapeEnd :: forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapeEnd x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. [Word8] -> STRef s (Buffer s) -> ST s Bool
bufferContains (BS -> [Word8]
bsUnpack BS
"script") STRef s (Buffer s)
lexerBuffer forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
True -> do
forall s. Lexer s -> ST s ()
doScriptDataEscaped Lexer s
x
Bool
False -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateScriptDataDoubleEscaped
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapeEnd Lexer s
x
| Word8 -> Bool
chrASCIILowerAlpha Word8
c -> do
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscapeEnd Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doScriptDataDoubleEscaped Lexer s
x
doBeforeAttrName :: Lexer s -> ST s ()
doBeforeAttrName :: forall s. Lexer s -> ST s ()
doBeforeAttrName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doAfterAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEqual -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unexpected-equals-sign-before-attribute-name"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenAttrInit STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrName Lexer s
x
| Bool
otherwise -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenAttrInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doAttrName Lexer s
x
doAttrName :: Lexer s -> ST s ()
doAttrName :: forall s. Lexer s -> ST s ()
doAttrName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
ST s ()
checkAttr
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doAfterAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEqual -> do
ST s ()
checkAttr
forall s. Lexer s -> ST s ()
doBeforeAttrValue Lexer s
x
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unexpected-character-in-attribute-name"
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrName Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrName Lexer s
x
where
checkAttr :: ST s ()
checkAttr = do
Int
i <- forall s. STRef s (TokenBuffer s) -> ST s Int
tokenTail STRef s (TokenBuffer s)
lexerToken
forall (m :: * -> *). Monad m => m Bool -> m () -> m ()
whenM (forall s. Int -> STRef s (TokenBuffer s) -> ST s Bool
tokenAttrNamePrune Int
i STRef s (TokenBuffer s)
lexerToken) forall a b. (a -> b) -> a -> b
$ do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"duplicate-attribute"
doAfterAttrName :: Lexer s -> ST s ()
doAfterAttrName :: forall s. Lexer s -> ST s ()
doAfterAttrName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doAfterAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEqual -> do
forall s. Lexer s -> ST s ()
doBeforeAttrValue Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenAttrInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doAttrName Lexer s
x
doBeforeAttrValue :: Lexer s -> ST s ()
doBeforeAttrValue :: forall s. Lexer s -> ST s ()
doBeforeAttrValue x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeAttrValue Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> ST s ()
doAttrValueDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> ST s ()
doAttrValueSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-attribute-value"
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doAttrValueUnquoted Lexer s
x
doAttrValueDoubleQuoted :: Lexer s -> ST s ()
doAttrValueDoubleQuoted :: forall s. Lexer s -> ST s ()
doAttrValueDoubleQuoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> ST s ()
doAfterAttrValue Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrAmpersand -> do
forall s. Lexer s -> LexerState -> ST s ()
returnSet Lexer s
x LexerState
StateAttrValueDoubleQuoted
forall s. Lexer s -> ST s ()
doCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrValAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrValueDoubleQuoted Lexer s
x
doAttrValueSingleQuoted :: Lexer s -> ST s ()
doAttrValueSingleQuoted :: forall s. Lexer s -> ST s ()
doAttrValueSingleQuoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> ST s ()
doAfterAttrValue Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrAmpersand -> do
forall s. Lexer s -> LexerState -> ST s ()
returnSet Lexer s
x LexerState
StateAttrValueSingleQuoted
forall s. Lexer s -> ST s ()
doCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrValAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrValueSingleQuoted Lexer s
x
doAttrValueUnquoted :: Lexer s -> ST s ()
doAttrValueUnquoted :: forall s. Lexer s -> ST s ()
doAttrValueUnquoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrAmpersand -> do
forall s. Lexer s -> LexerState -> ST s ()
returnSet Lexer s
x LexerState
StateAttrValueUnquoted
forall s. Lexer s -> ST s ()
doCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEqual Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGrave -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unexpected-character-in-unquoted-attribute-value"
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrValAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrValueUnquoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrValAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doAttrValueUnquoted Lexer s
x
doAfterAttrValue :: Lexer s -> ST s ()
doAfterAttrValue :: forall s. Lexer s -> ST s ()
doAfterAttrValue x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSolidus -> do
forall s. Lexer s -> ST s ()
doSelfClosingStartTag Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-between-attributes"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
doSelfClosingStartTag :: Lexer s -> ST s ()
doSelfClosingStartTag :: forall s. Lexer s -> ST s ()
doSelfClosingStartTag x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenTagStartSetSelfClosing STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-tag"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unexpected-solidus-in-tag"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doBeforeAttrName Lexer s
x
doBogusComment :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusComment Lexer s
x
doMarkupDeclarationOpen :: Lexer s -> ST s ()
doMarkupDeclarationOpen :: forall s. Lexer s -> ST s ()
doMarkupDeclarationOpen x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int -> Word8
f <- forall s. Lexer s -> ST s (Int -> Word8)
dataIndexer Lexer s
x
Int
n <- forall s. Lexer s -> ST s Int
dataRemain Lexer s
x
if | Int
n forall a. Ord a => a -> a -> Bool
> Int
1 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen Bool -> Bool -> Bool
&&
Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> Int -> ST s ()
skipWord Lexer s
x Int
2
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenCommentInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doCommentStart Lexer s
x
| Int
n forall a. Ord a => a -> a -> Bool
> Int
6 Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x44 Bool -> Bool -> Bool
|| Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x64) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x4F Bool -> Bool -> Bool
|| Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x6F) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x43 Bool -> Bool -> Bool
|| Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x63) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x54 Bool -> Bool -> Bool
|| Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x74) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x59 Bool -> Bool -> Bool
|| Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x79) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
5 forall a. Eq a => a -> a -> Bool
== Word8
0x50 Bool -> Bool -> Bool
|| Int -> Word8
f Int
5 forall a. Eq a => a -> a -> Bool
== Word8
0x70) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
6 forall a. Eq a => a -> a -> Bool
== Word8
0x45 Bool -> Bool -> Bool
|| Int -> Word8
f Int
6 forall a. Eq a => a -> a -> Bool
== Word8
0x65) -> do
forall s. Lexer s -> Int -> ST s ()
skipWord Lexer s
x Int
7
forall s. Lexer s -> ST s ()
doDoctype Lexer s
x
| Int
n forall a. Ord a => a -> a -> Bool
> Int
6 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x5B Bool -> Bool -> Bool
&&
Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x43 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x44 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x41 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x54 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
5 forall a. Eq a => a -> a -> Bool
== Word8
0x41 Bool -> Bool -> Bool
&&
Int -> Word8
f Int
6 forall a. Eq a => a -> a -> Bool
== Word8
0x5B -> do
forall s. Lexer s -> Int -> ST s ()
skipWord Lexer s
x Int
7
if Bool
True
then do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateCDATASection
forall s. Lexer s -> ST s ()
doCDATASection Lexer s
x
else do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"cdata-in-html-content"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenCommentInit STRef s (TokenBuffer s)
lexerToken
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend STRef s (TokenBuffer s)
lexerToken)
[ Word8
0x5B, Word8
0x43, Word8
0x44, Word8
0x41, Word8
0x54, Word8
0x41, Word8
0x5B ]
forall s. Lexer s -> ST s ()
doBogusComment Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"incorrectly-opened-comment"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenCommentInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusComment Lexer s
x
doCommentStart :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> ST s ()
doCommentStartDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"abrupt-closing-of-empty-comment"
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doCommentStartDash :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> ST s ()
doCommentEnd Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"abrupt-closing-of-empty-comment"
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-comment"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doComment :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doCommentLessThan Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> ST s ()
doCommentEndDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-comment"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doCommentLessThan :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrExclamation -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doCommentLessThanBang Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLess -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doCommentLessThan Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doCommentLessThanBang :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> ST s ()
doCommentLessThanBangDash Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doCommentLessThanBangDash :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> ST s ()
doCommentLessThanBangDashDash Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doCommentEndDash Lexer s
x
doCommentLessThanBangDashDash :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doCommentEnd Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"nested-comment"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doCommentEnd Lexer s
x
doCommentEndDash :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Lexer s -> ST s ()
doCommentEnd Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-comment"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doCommentEnd :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrExclamation -> do
forall s. Lexer s -> ST s ()
doCommentEndBang Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doCommentEnd Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-comment"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doCommentEndBang :: Lexer s -> ST s ()
x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrHyphen -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrExclamation STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doCommentEndDash Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"incorrectly-closed-comment"
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-comment"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrHyphen STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCommentAppend Word8
chrExclamation STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doComment Lexer s
x
doDoctype :: Lexer s -> ST s ()
doDoctype :: forall s. Lexer s -> ST s ()
doDoctype x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeDoctypeName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doBeforeDoctypeName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeInit STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-before-doctype-name"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doBeforeDoctypeName Lexer s
x
doBeforeDoctypeName :: Lexer s -> ST s ()
doBeforeDoctypeName :: forall s. Lexer s -> ST s ()
doBeforeDoctypeName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeDoctypeName Lexer s
x
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeInit STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-doctype-name"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeInit STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeInit STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeInit STRef s (TokenBuffer s)
lexerToken
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeName Lexer s
x
doDoctypeName :: Lexer s -> ST s ()
doDoctypeName :: forall s. Lexer s -> ST s ()
doDoctypeName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doAfterDoctypeName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8 -> Bool
chrASCIIUpperAlpha Word8
c -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeNameAppend (Word8 -> Word8
chrToLower Word8
c) STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeNameAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeName Lexer s
x
doAfterDoctypeName :: Lexer s -> ST s ()
doAfterDoctypeName :: forall s. Lexer s -> ST s ()
doAfterDoctypeName x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
Int -> Word8
f <- forall s. Lexer s -> ST s (Int -> Word8)
dataIndexer Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doAfterDoctypeName Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| (Word8
c forall a. Eq a => a -> a -> Bool
== Word8
0x50 Bool -> Bool -> Bool
|| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
0x70) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x55 Bool -> Bool -> Bool
|| Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x75) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x42 Bool -> Bool -> Bool
|| Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x62) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x4C Bool -> Bool -> Bool
|| Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x6C) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x49 Bool -> Bool -> Bool
|| Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x69) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x43 Bool -> Bool -> Bool
|| Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x63) -> do
forall s. Lexer s -> Int -> ST s ()
skipWord Lexer s
x Int
5
forall s. Lexer s -> ST s ()
doAfterDoctypePublicKeyword Lexer s
x
| (Word8
c forall a. Eq a => a -> a -> Bool
== Word8
0x53 Bool -> Bool -> Bool
|| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
0x73) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x59 Bool -> Bool -> Bool
|| Int -> Word8
f Int
0 forall a. Eq a => a -> a -> Bool
== Word8
0x79) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x53 Bool -> Bool -> Bool
|| Int -> Word8
f Int
1 forall a. Eq a => a -> a -> Bool
== Word8
0x73) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x54 Bool -> Bool -> Bool
|| Int -> Word8
f Int
2 forall a. Eq a => a -> a -> Bool
== Word8
0x74) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x45 Bool -> Bool -> Bool
|| Int -> Word8
f Int
3 forall a. Eq a => a -> a -> Bool
== Word8
0x65) Bool -> Bool -> Bool
&&
(Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x4D Bool -> Bool -> Bool
|| Int -> Word8
f Int
4 forall a. Eq a => a -> a -> Bool
== Word8
0x6D) -> do
forall s. Lexer s -> Int -> ST s ()
skipWord Lexer s
x Int
5
forall s. Lexer s -> ST s ()
doAfterDoctypeSystemKeyword Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"invalid-character-sequence-after-doctype-name"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doAfterDoctypePublicKeyword :: Lexer s -> ST s ()
doAfterDoctypePublicKeyword :: forall s. Lexer s -> ST s ()
doAfterDoctypePublicKeyword x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeDoctypePublicId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-after-doctype-public-keyword"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypePublicIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypePublicIdDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-after-doctype-public-keyword"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypePublicIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypePublicIdSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-doctype-public-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-quote-before-doctype-public-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doBeforeDoctypePublicId :: Lexer s -> ST s ()
doBeforeDoctypePublicId :: forall s. Lexer s -> ST s ()
doBeforeDoctypePublicId x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeDoctypePublicId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypePublicIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypePublicIdDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypePublicIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypePublicIdSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-doctype-public-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-quote-before-doctype-public-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doDoctypePublicIdDoubleQuoted :: Lexer s -> ST s ()
doDoctypePublicIdDoubleQuoted :: forall s. Lexer s -> ST s ()
doDoctypePublicIdDoubleQuoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> ST s ()
doAfterDoctypePublicId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"abrupt-doctype-public-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypePublicIdAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypePublicIdDoubleQuoted Lexer s
x
doDoctypePublicIdSingleQuoted :: Lexer s -> ST s ()
doDoctypePublicIdSingleQuoted :: forall s. Lexer s -> ST s ()
doDoctypePublicIdSingleQuoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> ST s ()
doAfterDoctypePublicId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"abrupt-doctype-public-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypePublicIdAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypePublicIdSingleQuoted Lexer s
x
doAfterDoctypePublicId :: Lexer s -> ST s ()
doAfterDoctypePublicId :: forall s. Lexer s -> ST s ()
doAfterDoctypePublicId x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBetweenDoctypePublicAndSystem Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-between-doctype-public-and-system-identifiers"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-between-doctype-public-and-system-identifiers"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-quote-before-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doBetweenDoctypePublicAndSystem :: Lexer s -> ST s ()
doBetweenDoctypePublicAndSystem :: forall s. Lexer s -> ST s ()
doBetweenDoctypePublicAndSystem x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBetweenDoctypePublicAndSystem Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-quote-before-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doAfterDoctypeSystemKeyword :: Lexer s -> ST s ()
doAfterDoctypeSystemKeyword :: forall s. Lexer s -> ST s ()
doAfterDoctypeSystemKeyword x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeDoctypeSystemId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-after-doctype-system-keyword"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-whitespace-after-doctype-system-keyword"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-quote-before-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doBeforeDoctypeSystemId :: Lexer s -> ST s ()
doBeforeDoctypeSystemId :: forall s. Lexer s -> ST s ()
doBeforeDoctypeSystemId x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doBeforeDoctypeSystemId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-quote-before-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doDoctypeSystemIdDoubleQuoted :: Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted :: forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrQuote -> do
forall s. Lexer s -> ST s ()
doAfterDoctypeSystemId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"abrupt-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdDoubleQuoted Lexer s
x
doDoctypeSystemIdSingleQuoted :: Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted :: forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrApostrophe -> do
forall s. Lexer s -> ST s ()
doAfterDoctypeSystemId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"abrupt-doctype-system-identifier"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSystemIdAppend Word8
c STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
doDoctypeSystemIdSingleQuoted Lexer s
x
doAfterDoctypeSystemId :: Lexer s -> ST s ()
doAfterDoctypeSystemId :: forall s. Lexer s -> ST s ()
doAfterDoctypeSystemId x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrTab Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrFF Bool -> Bool -> Bool
||
Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSpace -> do
forall s. Lexer s -> ST s ()
doAfterDoctypeSystemId Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-doctype"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenDoctypeSetForceQuirks STRef s (TokenBuffer s)
lexerToken
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unexpected-character-after-doctype-system-identifier"
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doBogusDoctype :: Lexer s -> ST s ()
doBogusDoctype :: forall s. Lexer s -> ST s ()
doBogusDoctype x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> LexerState -> ST s ()
state Lexer s
x LexerState
StateData
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
doBogusDoctype Lexer s
x
doCDATASection :: Lexer s -> ST s ()
doCDATASection :: forall s. Lexer s -> ST s ()
doCDATASection x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrBracketRight -> do
forall s. Lexer s -> ST s ()
doCDATASectionBracket Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrEOF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"eof-in-cdata"
forall s. STRef s (TokenBuffer s) -> ST s ()
tokenEOFInit STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
emit Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doCDATASection Lexer s
x
doCDATASectionBracket :: Lexer s -> ST s ()
doCDATASectionBracket :: forall s. Lexer s -> ST s ()
doCDATASectionBracket x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrBracketRight -> do
forall s. Lexer s -> ST s ()
doCDATASectionEnd Lexer s
x
| Bool
otherwise -> do
forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenCharInit Word8
chrBracketRight STRef s (TokenBuffer s)
lexerToken
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doCDATASection Lexer s
x
doCDATASectionEnd :: Lexer s -> ST s ()
doCDATASectionEnd :: forall s. Lexer s -> ST s ()
doCDATASectionEnd x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrBracketRight -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doCDATASectionEnd Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrGreater -> do
forall s. Lexer s -> ST s ()
doData Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrBracketRight
forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
chrBracketRight
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doCDATASection Lexer s
x
doCharacterReference :: Lexer s -> ST s ()
doCharacterReference :: forall s. Lexer s -> ST s ()
doCharacterReference x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
chrAmpersand STRef s (Buffer s)
lexerBuffer
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Bool
lexerIgnore -> do
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
| Word8 -> Bool
chrASCIIAlphanumeric Word8
c -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doNamedCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrNumberSign -> do
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doNumericCharacterReference Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
doNamedCharacterReference :: Lexer s -> ST s ()
doNamedCharacterReference :: forall s. Lexer s -> ST s ()
doNamedCharacterReference x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int
o <- forall s a. STRef s a -> ST s a
rref STRef s Int
lexerOffset
case BS -> Maybe (BS, BS, BS)
entityMatch (Int -> BS -> BS
bsDrop Int
o BS
lexerData) of
Just (BS
p, BS
v, BS
_) -> do
forall s. Lexer s -> Int -> ST s ()
skipWord Lexer s
x forall a b. (a -> b) -> a -> b
$ BS -> Int
bsLen BS
p
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ (BS -> [Word8]
bsUnpack BS
p) forall a b. (a -> b) -> a -> b
$
forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend STRef s (Buffer s)
lexerBuffer
Bool
attr <- forall s. Lexer s -> ST s Bool
consumingAttibute Lexer s
x
Bool
semi <- forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ BS -> Maybe Word8
bsLast BS
p forall a. Eq a => a -> a -> Bool
== forall a. a -> Maybe a
Just Word8
chrSemicolon
Word8
c <- forall s. Lexer s -> ST s Word8
peekWord Lexer s
x
if | Bool
attr
, Bool -> Bool
not Bool
semi
, Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSemicolon Bool -> Bool -> Bool
|| Word8 -> Bool
chrASCIIAlphanumeric Word8
c -> do
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
| Bool
otherwise -> do
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Bool -> Bool
not Bool
semi) forall a b. (a -> b) -> a -> b
$
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-semicolon-after-character-reference"
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ (BS -> [Word8]
bsUnpack BS
v) forall a b. (a -> b) -> a -> b
$
forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
Maybe (BS, BS, BS)
Nothing -> do
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
doAmbiguousAmpersand Lexer s
x
doAmbiguousAmpersand :: Lexer s -> ST s ()
doAmbiguousAmpersand :: forall s. Lexer s -> ST s ()
doAmbiguousAmpersand x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIAlphanumeric Word8
c -> do
forall s. Lexer s -> ST s Bool
consumingAttibute Lexer s
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
True -> forall s. Word8 -> STRef s (TokenBuffer s) -> ST s ()
tokenAttrValAppend Word8
c STRef s (TokenBuffer s)
lexerToken
Bool
False -> forall s. Lexer s -> Word8 -> ST s ()
emitChar Lexer s
x Word8
c
forall s. Lexer s -> ST s ()
doAmbiguousAmpersand Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSemicolon -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"unknown-named-character-reference"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
doNumericCharacterReference :: Lexer s -> ST s ()
doNumericCharacterReference :: forall s. Lexer s -> ST s ()
doNumericCharacterReference x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
forall s a. STRef s a -> a -> ST s ()
wref STRef s Int
lexerCode Int
0
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrUpperX Bool -> Bool -> Bool
|| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrLowerX -> do
forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend Word8
c STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
doHexCharacterReferenceStart Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doDecimalCharacterReference Lexer s
x
doHexCharacterReferenceStart :: Lexer s -> ST s ()
doHexCharacterReferenceStart :: forall s. Lexer s -> ST s ()
doHexCharacterReferenceStart x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIHexDigit Word8
c -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doHexCharacterReference Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"absence-of-digits-in-numeric-character-reference"
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
doDecimalCharacterReferenceStart :: Lexer s -> ST s ()
doDecimalCharacterReferenceStart :: forall s. Lexer s -> ST s ()
doDecimalCharacterReferenceStart x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIDigit Word8
c -> do
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doDecimalCharacterReference Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"absence-of-digits-in-numeric-character-reference"
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
doHexCharacterReference :: Lexer s -> ST s ()
doHexCharacterReference :: forall s. Lexer s -> ST s ()
doHexCharacterReference x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIDigit Word8
c -> do
forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s Int
lexerCode forall a b. (a -> b) -> a -> b
$ \Int
y -> Int
16 forall a. Num a => a -> a -> a
* Int
y forall a. Num a => a -> a -> a
+ (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
c forall a. Num a => a -> a -> a
- Int
0x30)
forall s. Lexer s -> ST s ()
doHexCharacterReference Lexer s
x
| Word8 -> Bool
chrASCIIUpperHexDigit Word8
c -> do
forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s Int
lexerCode forall a b. (a -> b) -> a -> b
$ \Int
y -> Int
16 forall a. Num a => a -> a -> a
* Int
y forall a. Num a => a -> a -> a
+ (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
c forall a. Num a => a -> a -> a
- Int
0x37)
forall s. Lexer s -> ST s ()
doHexCharacterReference Lexer s
x
| Word8 -> Bool
chrASCIILowerHexDigit Word8
c -> do
forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s Int
lexerCode forall a b. (a -> b) -> a -> b
$ \Int
y -> Int
16 forall a. Num a => a -> a -> a
* Int
y forall a. Num a => a -> a -> a
+ (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
c forall a. Num a => a -> a -> a
- Int
0x57)
forall s. Lexer s -> ST s ()
doHexCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSemicolon -> do
forall s. Lexer s -> ST s ()
doNumericCharacterReferenceEnd Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-semicolon-after-character-reference"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doNumericCharacterReferenceEnd Lexer s
x
doDecimalCharacterReference :: Lexer s -> ST s ()
doDecimalCharacterReference :: forall s. Lexer s -> ST s ()
doDecimalCharacterReference x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Word8
c <- forall s. Lexer s -> ST s Word8
nextWord Lexer s
x
if | Word8 -> Bool
chrASCIIDigit Word8
c -> do
forall s a. STRef s a -> (a -> a) -> ST s ()
uref STRef s Int
lexerCode forall a b. (a -> b) -> a -> b
$ \Int
y -> Int
10 forall a. Num a => a -> a -> a
* Int
y forall a. Num a => a -> a -> a
+ (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
c forall a. Num a => a -> a -> a
- Int
0x30)
forall s. Lexer s -> ST s ()
doDecimalCharacterReference Lexer s
x
| Word8
c forall a. Eq a => a -> a -> Bool
== Word8
chrSemicolon -> do
forall s. Lexer s -> ST s ()
doNumericCharacterReferenceEnd Lexer s
x
| Bool
otherwise -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"missing-semicolon-after-character-reference"
forall s. Lexer s -> ST s ()
backWord Lexer s
x
forall s. Lexer s -> ST s ()
doNumericCharacterReferenceEnd Lexer s
x
doNumericCharacterReferenceEnd :: Lexer s -> ST s ()
doNumericCharacterReferenceEnd :: forall s. Lexer s -> ST s ()
doNumericCharacterReferenceEnd x :: Lexer s
x@Lexer {Bool
STRef s Int
STRef s [Word8]
STRef s (DList BS)
STRef s (Buffer s)
STRef s (TokenBuffer s)
STRef s LexerState
STRef s LexerSkip
BS
lexerCode :: STRef s Int
lexerErrors :: STRef s (DList BS)
lexerSkip :: STRef s LexerSkip
lexerReturn :: STRef s LexerState
lexerState :: STRef s LexerState
lexerLast :: STRef s [Word8]
lexerBuffer :: STRef s (Buffer s)
lexerToken :: STRef s (TokenBuffer s)
lexerOffset :: STRef s Int
lexerLog :: Bool
lexerIgnore :: Bool
lexerData :: BS
lexerCode :: forall s. Lexer s -> STRef s Int
lexerErrors :: forall s. Lexer s -> STRef s (DList BS)
lexerSkip :: forall s. Lexer s -> STRef s LexerSkip
lexerReturn :: forall s. Lexer s -> STRef s LexerState
lexerState :: forall s. Lexer s -> STRef s LexerState
lexerLast :: forall s. Lexer s -> STRef s [Word8]
lexerBuffer :: forall s. Lexer s -> STRef s (Buffer s)
lexerToken :: forall s. Lexer s -> STRef s (TokenBuffer s)
lexerOffset :: forall s. Lexer s -> STRef s Int
lexerLog :: forall s. Lexer s -> Bool
lexerIgnore :: forall s. Lexer s -> Bool
lexerData :: forall s. Lexer s -> BS
..} = do
Int
c <- forall s a. STRef s a -> ST s a
rref STRef s Int
lexerCode
let n :: Word8
n = forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
c
if | Int
c forall a. Eq a => a -> a -> Bool
== Int
0 -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"null-character-reference"
forall s a. STRef s a -> a -> ST s ()
wref STRef s Int
lexerCode Int
0xFFFD
| Int
c forall a. Ord a => a -> a -> Bool
> Int
0x10FFFF -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"character-reference-outside-unicode-range"
forall s a. STRef s a -> a -> ST s ()
wref STRef s Int
lexerCode Int
0xFFFD
| Int -> Bool
chrSurrogate Int
c -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"surrogate-character-reference"
forall s a. STRef s a -> a -> ST s ()
wref STRef s Int
lexerCode Int
0xFFFD
| Int -> Bool
chrNonCharacter Int
c -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"noncharacter-character-reference"
| Int
c forall a. Eq a => a -> a -> Bool
== Int
0x0D Bool -> Bool -> Bool
|| (Int -> Bool
chrWord8 Int
c Bool -> Bool -> Bool
&& Word8 -> Bool
chrControl Word8
n Bool -> Bool -> Bool
&& Bool -> Bool
not (Word8 -> Bool
chrWhitespace Word8
n)) -> do
forall s. Lexer s -> BS -> ST s ()
parseError Lexer s
x BS
"control-character-reference"
forall (m :: * -> *) a.
Applicative m =>
Maybe a -> (a -> m ()) -> m ()
whenJust (forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup Int
c Map Int Int
codeMap) forall a b. (a -> b) -> a -> b
$ forall s a. STRef s a -> a -> ST s ()
wref STRef s Int
lexerCode
| Bool
otherwise ->
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
forall s. STRef s (Buffer s) -> ST s ()
bufferReset STRef s (Buffer s)
lexerBuffer
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ (Int -> [Word8]
chrUTF8 Int
c) forall a b. (a -> b) -> a -> b
$ forall a b c. (a -> b -> c) -> b -> a -> c
flip forall s. Word8 -> STRef s (Buffer s) -> ST s ()
bufferAppend STRef s (Buffer s)
lexerBuffer
forall s. Lexer s -> ST s ()
flushCodePoints Lexer s
x
forall s. Lexer s -> ST s ()
returnState Lexer s
x
codeMap :: Map Int Int
codeMap :: Map Int Int
codeMap = forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
[ (Int
0x80, Int
0x20AC)
, (Int
0x82, Int
0x201A)
, (Int
0x83, Int
0x0192)
, (Int
0x84, Int
0x201E)
, (Int
0x85, Int
0x2026)
, (Int
0x86, Int
0x2020)
, (Int
0x87, Int
0x2021)
, (Int
0x88, Int
0x02C6)
, (Int
0x89, Int
0x2030)
, (Int
0x8A, Int
0x0160)
, (Int
0x8B, Int
0x2039)
, (Int
0x8C, Int
0x0152)
, (Int
0x8E, Int
0x017D)
, (Int
0x91, Int
0x2018)
, (Int
0x92, Int
0x2019)
, (Int
0x93, Int
0x201C)
, (Int
0x94, Int
0x201D)
, (Int
0x95, Int
0x2022)
, (Int
0x96, Int
0x2013)
, (Int
0x97, Int
0x2014)
, (Int
0x98, Int
0x02DC)
, (Int
0x99, Int
0x2122)
, (Int
0x9A, Int
0x0161)
, (Int
0x9B, Int
0x203A)
, (Int
0x9C, Int
0x0153)
, (Int
0x9E, Int
0x017E)
, (Int
0x9F, Int
0x0178)
]