Safe Haskell | None |
---|---|
Language | Haskell2010 |
Defines a token type used by the lexer.
Synopsis
- data Token
- = TDoctype {
- tDoctypeName :: !BS
- tDoctypeQuirks :: !Bool
- tDoctypePublic :: !(Maybe BS)
- tDoctypeSystem :: !(Maybe BS)
- | TStart {
- tStartName :: !BS
- tStartClosed :: !Bool
- tStartAttr :: ![TAttr]
- | TEnd { }
- | TComment {
- tCommentData :: !BS
- | TChar { }
- | TEOF
- = TDoctype {
- data TokenBuffer s = TokenBuffer {}
- data TAttr = TAttr {}
- tokenAttr :: BS -> BS -> TAttr
- tokenHasAttr :: BS -> Token -> Bool
- tokenGetAttr :: BS -> Token -> Maybe TAttr
- tokenGetAttrVal :: BS -> Token -> Maybe BS
- tokenBuffer :: ST s (STRef s (TokenBuffer s))
- tokenCapacity :: STRef s (TokenBuffer s) -> ST s (Int, Int)
- tokenReset :: STRef s (TokenBuffer s) -> ST s ()
- tokenTail :: STRef s (TokenBuffer s) -> ST s Int
- tokenFirst :: STRef s (TokenBuffer s) -> ST s Int
- tokenNext :: STRef s (TokenBuffer s) -> ST s Int
- tokenCount :: STRef s (TokenBuffer s) -> ST s Int
- tokenOffset :: STRef s (TokenBuffer s) -> ST s [Int]
- tokenList :: STRef s (TokenBuffer s) -> ST s [Token]
- tokenDrop :: STRef s (TokenBuffer s) -> ST s ()
- tokenHasEOF :: STRef s (TokenBuffer s) -> ST s Bool
- tokenSlice :: Int -> Int -> STRef s (TokenBuffer s) -> ST s [Word8]
- tokenTagStartName :: Int -> STRef s (TokenBuffer s) -> ST s (Maybe [Word8])
- tokenTagEndName :: Int -> STRef s (TokenBuffer s) -> ST s (Maybe [Word8])
- tokenDoctypeType :: Int
- tokenTagStartType :: Int
- tokenTagEndType :: Int
- tokenCommentType :: Int
- tokenCharType :: Int
- tokenEOFType :: Int
- tokenDoctypeInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenDoctypeNameAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenDoctypeSetForceQuirks :: STRef s (TokenBuffer s) -> ST s ()
- tokenDoctypePublicIdInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenDoctypePublicIdAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenDoctypeSystemIdInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenDoctypeSystemIdAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenTagStartInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenTagStartSetSelfClosing :: STRef s (TokenBuffer s) -> ST s ()
- tokenTagEndInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenTagNameAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenAttrInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenAttrNameAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenAttrValAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenAttrNamePrune :: Int -> STRef s (TokenBuffer s) -> ST s Bool
- tokenCommentInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenCommentAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenCharInit :: Word8 -> STRef s (TokenBuffer s) -> ST s ()
- tokenEOFInit :: STRef s (TokenBuffer s) -> ST s ()
- tokenType :: Int -> STRef s (TokenBuffer s) -> ST s Int
- tokenSize :: Int -> STRef s (TokenBuffer s) -> ST s Int
- tokenPack :: Int -> STRef s (TokenBuffer s) -> ST s Token
Documentation
Defines the token type. The token type is used for testing and debugging only.
TDoctype | |
| |
TStart | |
| |
TEnd | |
TComment | |
| |
TChar | |
TEOF |
data TokenBuffer s Source #
A type of buffer used to hold tokens.
An HTML element attribute type.
TAttr | |
|
tokenBuffer :: ST s (STRef s (TokenBuffer s)) Source #
Makes a new token buffer.
tokenCapacity :: STRef s (TokenBuffer s) -> ST s (Int, Int) Source #
Gets the capacity of the buffer.
tokenReset :: STRef s (TokenBuffer s) -> ST s () Source #
Resets a token buffer.
tokenFirst :: STRef s (TokenBuffer s) -> ST s Int Source #
Positions the emitter to the first token and returns its offset.
tokenNext :: STRef s (TokenBuffer s) -> ST s Int Source #
Positions the emitter to the next token and returns its offset.
tokenCount :: STRef s (TokenBuffer s) -> ST s Int Source #
Counts the number of tokens in the buffer.
tokenOffset :: STRef s (TokenBuffer s) -> ST s [Int] Source #
Gets a list of the tokens in the buffer.
tokenList :: STRef s (TokenBuffer s) -> ST s [Token] Source #
Gets a list of the tokens in the buffer.
tokenHasEOF :: STRef s (TokenBuffer s) -> ST s Bool Source #
Returns whether a buffer includes an EOF token.
tokenSlice :: Int -> Int -> STRef s (TokenBuffer s) -> ST s [Word8] Source #
Returns a slice of the data area of a token buffer.
tokenTagStartName :: Int -> STRef s (TokenBuffer s) -> ST s (Maybe [Word8]) Source #
Returns the start tag name at for the token at an offset.
tokenTagEndName :: Int -> STRef s (TokenBuffer s) -> ST s (Maybe [Word8]) Source #
Returns the end tag name at for the token at an offset.
tokenDoctypeType :: Int Source #
Defines the type for a DOCTYPE token.
tokenTagStartType :: Int Source #
Defines the type for a start tag token.
tokenTagEndType :: Int Source #
Defines the type for a end tag token.
tokenCommentType :: Int Source #
Defines the type for a comment token.
tokenCharType :: Int Source #
Defines the type for a character token.
tokenEOFType :: Int Source #
Defines the type for an EOF token.
tokenDoctypeInit :: STRef s (TokenBuffer s) -> ST s () Source #
Adds a new DOCTYPE token to the lexer.
tokenDoctypeNameAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to the current DOCTYPE token.
tokenDoctypeSetForceQuirks :: STRef s (TokenBuffer s) -> ST s () Source #
Sets the force quirks flag for the current DOCTYPE.
tokenDoctypePublicIdInit :: STRef s (TokenBuffer s) -> ST s () Source #
Initializes the DOCTYPE public ID.
tokenDoctypePublicIdAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to the DOCTYPE public ID.
tokenDoctypeSystemIdInit :: STRef s (TokenBuffer s) -> ST s () Source #
Initializes the DOCTYPE system ID.
tokenDoctypeSystemIdAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to the DOCTYPE system ID.
tokenTagStartInit :: STRef s (TokenBuffer s) -> ST s () Source #
Adds a new start tag to the lexer.
tokenTagStartSetSelfClosing :: STRef s (TokenBuffer s) -> ST s () Source #
Adds a new start tag to the lexer.
tokenTagEndInit :: STRef s (TokenBuffer s) -> ST s () Source #
Adds a new end tag to the lexer.
tokenTagNameAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to a tag name if the token is a tag.
tokenAttrInit :: STRef s (TokenBuffer s) -> ST s () Source #
Starts a new attribute
tokenAttrNameAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to the latest attribute name.
tokenAttrValAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to the latest attribute value.
tokenAttrNamePrune :: Int -> STRef s (TokenBuffer s) -> ST s Bool Source #
Checks for duplicate attribute names. Refer to section 12.2.5.33 for details.
tokenCommentInit :: STRef s (TokenBuffer s) -> ST s () Source #
Adds a new comment token to the lexer.
tokenCommentAppend :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Appends a character to the current comment token.
tokenCharInit :: Word8 -> STRef s (TokenBuffer s) -> ST s () Source #
Initializes a text token.
tokenEOFInit :: STRef s (TokenBuffer s) -> ST s () Source #
Initializes an EOF token.