úÎe¿cG*      !"#$%&'()Safe :DFMORT A location in a source file.OAn abstract source of input tokens that we want to perform lexical analysis on.0Each token is associated with a source location loc%. A a sequence of tokens has type input, and a single token type (  input).@Skip over values from the source that match the given predicate.™Try to evaluate the given computation that may pull values from the source. If it returns Nothing then rewind the source to the original position.IPull a value from the source, provided it matches the given predicate.˜Use a fold function to select a some consecutive tokens from the source that we want to process, also passing the current index to the fold function.\The maximum number of tokens to select is set by the first argument, which can be set to * for no maximum.1Bump the source location using the given element. Get the remaining input. Class of sequences of things. An element of a sequence. Yield the length of a sequence. TMake a source from a list of input tokens, maintaining the state in the IO monad. Starting source location.9Function to bump the current location by one input token.List of input tokens.     Safe-:DFMOT@Scanner of input tokens that produces a result value of type a when successful.`Apply a scanner to a source of input tokens, where the tokens are represented as a lazy list.3The result values are also produced in a lazy list.Safe:DFMOT _Accept the next token if it matches the given predicate, returning that token as the result.ZSkip tokens that match the given predicate, before applying the given argument scanner.FWhen lexing most source languages you can use this to skip whitespace.\Accept the next input token if it is equal to the given one, and return a result of type a.hAccept a fixed length sequence of tokens that match the given sequence, and return a result of type a.fUse the given function to check whether to accept the next token, returning the result it produces.}Use the given function to check whether to accept a fixed length sequence of tokens, returning the result it produces.tCombine two argument scanners into a result scanner, where the first argument scanner is tried before the second.’Combine a list of argumenet scanners a result scanner, where each argument scanner is tried in turn until we find one that matches (or not).GMunch input tokens, using a predicate to select the prefix to consider.Given munch (Just n) match acceptR, we select a contiguous sequence of tokens up to length n using the predicate match , then pass that sequence to accept) to make a result value out of it. If match selects no tokens, or accept returns *F then the scanner fails and no tokens are consumed from the source.)For example, to scan natural numbers use: °scanNat :: Monad m => Scanner m loc [Char] (loc, Integer) scanNat = munchPred Nothing match accept where match _ c = isDigit c accept cs = Just (read cs) -To match Haskell style constructor names use: ÕscanCon :: Monad m => Scanner m loc [Char] (loc, String) scanCon = munchPred Nothing match accept where match 0 c = isUpper c match _ c = isAlphaNum c accept cs = Just cs 6If you want to detect built-in constructor names like Int and Float then you can do it in the acceptC function and produce a different result constructor for each one. Like Z, but we accept prefixes of any length, and always accept the input tokens that match.!Like â, but we can use a fold function to select the prefix of tokens to consider. This is useful when lexing comments, and string literals where consecutive tokens can have special meaning (ie escaped quote characters).See the source of scanHaskellChar in the Text.Lexer.Inchworm.Char(, module for an example of its usage. ,Maximum number of tokens to consider, or * for no maximum.uPredicate to decide whether to consider the next input token, also passed the index of the token in the prefix.PTake the prefix of input tokens and decide whether to produce a result value. Scan a prefix of tokens of type is#, and produce a result of type a if it matches. sPredicate to decide whether to accept the next input token, also passed the index of the token in the prefix.!,Maximum number of tokens to consider, or * for no maximum.…Fold function to decide whether to consider the next input token. The next token will be considered if the function produces a +P with its new state. We stop considering tokens the first time it returns *.Initial state for the fold.PTake the prefix of input tokens and decide whether to produce a result value. Scan a prefix of tokens of type is", and produce a result of type a if it matches.  !  !Safe:DFMOT"“Scan a list of generic input tokens in the IO monad, returning the source location of the final input token, along with the remaining input.!NOTE: If you just want to scan a , of characters use  scanStringIO from Text.Lexer.Inchworm.Char"Starting source location.9Function to bump the current location by one input token.List of input tokens.Scanner to apply.  !""  !"Safe:DFMOT #Scan a string in the IO monad.$bBump a location using the given character, updating the line and column number as appropriate. %&Scan a decimal integer, with optional - and + sign specifiers.&4Scan a literal string, enclosed in double quotes.gWe handle the escape codes listed in Section 2.6 of the Haskell Report, but not string gaps or the & terminator.'4Scan a literal character, enclosed in single quotes.GWe handle the escape codes listed in Section 2.6 of the Haskell Report.(Scan a Haskell block comment.)Scan a Haskell line comment.- Decode escape codes in a string..0Read a character literal, handling escape codes. #$%&'()-./  !"#$%&'() #$%'&() #$%&'()-./0      !"#$%&'()*+,-./-.0-.12345'inchworm-1.0.0.1-KVsQTLSF78H1dCzy3BOHWcText.Lexer.Inchworm.SourceText.Lexer.Inchworm.ScannerText.Lexer.InchwormText.Lexer.Inchworm.CharText.Lexer.Inchworm.CombinatorLocationSource sourceSkip sourceTry sourcePull sourcePulls sourceBumpLocsourceRemainingSequenceElemlengthmakeListSourceIO $fSequence[]$fShowLocationScanner runScannerscanSourceToList$fMonadScanner$fApplicativeScanner$fFunctorScanner satisfiesskipacceptacceptsfromfromsaltalts munchPred munchWord munchFold scanListIO scanStringIObumpLocationWithChar scanIntegerscanHaskellStringscanHaskellCharscanHaskellCommentBlockscanHaskellCommentLinebaseGHC.BaseNothingJustString decodeStringreadChar escapedChars