Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
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.