{-| Description: Tokenization rules for characters which should not be processed further, without an exit condition. Copyright: (c) 2020 Sam May License: MPL-2.0 Maintainer: ag.eitilt@gmail.com Stability: stable Portability: portable -} module Web.Mangrove.Parse.Tokenize.PlainText ( tokenPlainText ) where import Web.Mangrove.Parse.Common.Error import Web.Mangrove.Parse.Tokenize.Common import Web.Willow.Common.Encoding.Character -- | __HTML:__ -- @[PLAINTEXT state] -- (https://html.spec.whatwg.org/multipage/parsing.html#plaintext-state)@ -- -- The parsing instructions rooted in the 'PlainTextState' section of the state -- machine. tokenPlainText :: Tokenizer (TokenizerOutput Token) tokenPlainText = tokenizer Nothing [ if_ (== '\NUL') $ emit ([UnexpectedNullCharacter], Character replacementChar) , elseChar $ \c -> emit ([], Character c) ]