HarmTrace-Base-1.4.0.1: Parsing and unambiguously representing musical chords.

Copyright(c) 2012--2014 W. Bas de Haas and Jose Pedro Magalhaes, Multiphonyx Holding BV
LicenseLGPL-3
Maintainerbas@chordify.net, dreixel@chordify.net
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

HarmTrace.Base.Parse.General

Contents

Description

Summary: Some general parsing utilities used for parsing textual chord representations.

Synopsis

Top level parsers

parseData :: (ListLike s a, Show a) => P (Str a s LineColPos) b -> s -> b Source

Top-level parser that ignores error-reporting, regardless of there were error in the parse

parseDataWithErrors :: (ListLike s a, Show a) => P (Str a s LineColPos) b -> s -> (b, [Error LineColPos]) Source

Top-level parser that returns both the result as well as a (possibly empty) list of error-corrections.

parseDataSafe :: (ListLike s a, Show a, Show s) => P (Str a s LineColPos) b -> s -> b Source

This is identical to parseData however it will throw an error when the the list with parsing errors is not empty. No, this will not make your program more safe. However, in certain cases you really want to be sure that parsing has finished without errors. In those cases you should use parseDataSafe.

Some general parsers

pString :: (ListLike state a, IsLocationUpdatedBy loc a, Show a, Eq a) => [a] -> P (Str a state loc) [a] Source

Parses a specific string

pLineEnd :: Parser String Source

Parses UNIX and DOS/WINDOWS line endings including trailing whitespace

pManyTill :: P st a -> P st b -> P st [a] Source

Parses an arbitrary times the first parsing combinator until the parsing second parsing combinator is encountered. The result of the second parsing combinator is ignored.