range-0.1.2.0: This has a bunch of code for specifying and managing ranges in your code.

Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Range.Parser

Description

It should not be unexpected that you will be given a string representation of some ranges and you will need to parse them so that you can then do some further processing. This parser exists in order to make the most common forms of range strings easy to parse. It does not cover all cases however but you should not be too worried about that because you should be able to write your own parser using parsec or Alex/Happy and then you can convert everything that you parse into a RangeTree object for easier processing.

Synopsis

Documentation

parseRanges :: Read a => String -> Either ParseError [Range a] Source

Given a string this function will either return a parse error back to the user or the list of ranges that are represented by the parsed string.

ranges :: Read a => RangeParserArgs -> Parser [Range a] Source

Given the parser arguments this returns a parser that is capable of parsing a list of ranges.

data RangeParserArgs Source

The arguments that are used, and can be modified, while parsing a standard range string.

Constructors

Args 

Fields

unionSeparator :: String

A separator that represents a union.

rangeSeparator :: String

A separator that separates the two halves of a range.

wildcardSymbol :: String

A separator that implies an unbounded range.

defaultArgs :: RangeParserArgs Source

These are the default arguments that are used by the parser. Please feel free to use the default arguments for you own parser and modify it from the defaults at will.