HaXml-1.25.6: Utilities for manipulating XML documents
Safe HaskellSafe-Inferred
LanguageHaskell98

Text.XML.HaXml.Xtract.Lex

Description

This is another hand-written lexer, this time for the Xtract command-language. The entry point is lexXtract. You don't normally need to use this module directly - the lexer is called automatically by the parser. (We only expose this interface for debugging purposes.)

The Xtract command language is very like the XPath specification.

Synopsis

Documentation

lexXtract :: (String -> String) -> String -> [Token] Source #

First argument is a transformer for pattern strings, e.g. map toLower, but only applying to parts of the pattern not in quotation marks. (Needed to canonicalise HTML where tags are case-insensitive, but attribute values are case sensitive.)

data Posn Source #

Constructors

Pn Int 

Instances

Instances details
Eq Posn Source # 
Instance details

Defined in Text.XML.HaXml.Xtract.Lex

Methods

(==) :: Posn -> Posn -> Bool

(/=) :: Posn -> Posn -> Bool

Show Posn Source # 
Instance details

Defined in Text.XML.HaXml.Xtract.Lex

Methods

showsPrec :: Int -> Posn -> ShowS

show :: Posn -> String

showList :: [Posn] -> ShowS

data TokenT Source #

Constructors

Symbol String 
TokString String 
TokNum Integer 

Instances

Instances details
Eq TokenT Source # 
Instance details

Defined in Text.XML.HaXml.Xtract.Lex

Methods

(==) :: TokenT -> TokenT -> Bool

(/=) :: TokenT -> TokenT -> Bool

Show TokenT Source # 
Instance details

Defined in Text.XML.HaXml.Xtract.Lex

Methods

showsPrec :: Int -> TokenT -> ShowS

show :: TokenT -> String

showList :: [TokenT] -> ShowS

type Token = Either String (Posn, TokenT) Source #