Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Util.ParseText

Contents

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)

casual parsing

combinators

between :: Parser _a -> Parser _b -> Parser a -> Parser a Source #

parsers

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 => forall a. f a -> f [a] #

Zero or more.