Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

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 Parser a = A.Parser a Source #

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

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

parse_lines :: Int -> Parser a -> Text -> Either Text a Source #

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

infer_line Source #

Arguments

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

(line, lineno from 0, column from 0)

between :: Parser _a -> Parser _b -> 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.