HaXml-1.25.14: Utilities for manipulating XML documents

Safe Haskell | Safe-Inferred
Language | Haskell98

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

- lexXtract :: (String -> String) -> String -> [Token]
- data Posn = Pn Int
- data TokenT
  - = Symbol String
  - | TokString String
  - | TokNum Integer
- type Token = Either String (Posn, TokenT)

# 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

Show Posn Source # |
Instance details Defined in Text.XML.HaXml.Xtract.Lex Methods showsPrec :: Int -> Posn -> ShowS Source # show :: Posn -> String Source # showList :: [Posn] -> ShowS Source #
Eq Posn Source # |
Instance details Defined in Text.XML.HaXml.Xtract.Lex Methods (==) :: Posn -> Posn -> Bool Source # (/=) :: Posn -> Posn -> Bool Source #

data TokenT Source #

Constructors

Symbol String |
TokString String |
TokNum Integer |

#### Instances

Instances details

Show TokenT Source # |
Instance details Defined in Text.XML.HaXml.Xtract.Lex Methods showsPrec :: Int -> TokenT -> ShowS Source # show :: TokenT -> String Source # showList :: [TokenT] -> ShowS Source #
Eq TokenT Source # |
Instance details Defined in Text.XML.HaXml.Xtract.Lex Methods (==) :: TokenT -> TokenT -> Bool Source # (/=) :: TokenT -> TokenT -> Bool Source #

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