Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred

Util.ParseText

Description

Parsing utilities for Text, using Attoparsec.

This module also exports some basic combinators. The idea is that modules that want to do a bit of parsing should be able to import this and need not import the underlying parsing library, which should make it easier to switch parsing libraries in the future if I want to. Of course the parsers may return a different type (ByteString vs. Text) so callers will still need a little modification to switch libraries.

Synopsis

Documentation

type Row = Int Source #

data Error Source #

Constructors

Error 

Fields

Instances

Instances details
Show Error Source # 
Instance details

Defined in Util.ParseText

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Util.ParseText

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

type Parser a = A.Parser a Source #

parse1 :: Parser a -> Text -> Either Text a Source #

Parse all the text, and annotate the error with the char number. For single-line input.

parse :: Parser a -> Text -> Either Error a Source #

Parse all of the text, and annotate the error with line number and column.

infer_location Source #

Arguments

:: Text 
-> Text 
-> Maybe (Text, (Int, Int))

(line, row from 1, column from 1)

between :: Parser x -> Parser y -> Parser a -> Parser a Source #

lexeme :: Parser a -> Parser a Source #

Convert a parser into a lexeme parser by skipping whitespace afterwards.

p_word :: Parser Text Source #

A word of non-space chars.

many :: Alternative f => f a -> f [a] #

Zero or more.