graphviz-2999.7.0.0: Graphviz bindings for Haskell.

Maintainer[email protected]

Data.GraphViz.Types.Parsing

Contents

Description

This module defines simple helper functions for use with Text.ParserCombinators.Poly.Lazy.

Note that the ParseDot instances for Bool, etc. match those specified for use with Graphviz (e.g. non-zero integers are equivalent to True).

You should not be using this module; rather, it is here for informative/documentative reasons. If you want to parse a Data.GraphViz.Types.DotGraph, you should use Data.GraphViz.Types.parseDotGraph rather than its ParseDot instance.

Synopsis

Re-exporting pertinent parts of Polyparse.

The ParseDot class.

type Parse a = Parser Char aSource

A ReadS-like type alias.

parseIt :: ParseDot a => String -> (a, String)Source

Parse the required value, returning also the rest of the input String that hasn't been parsed.

Convenience parsing combinators.

onlyBool :: Parse BoolSource

Use this when you do not want numbers to be treated as Bool values.

isNumString :: String -> BoolSource

Determine if this String represents a number.

quotedString :: Parse StringSource

Used when quotes are explicitly required;

parseStrictFloat :: Parse DoubleSource

Parse a floating point number that actually contains decimals.

noneOf :: Eq a => [a] -> Parser a aSource

newline' :: Parse ()Source

Consume all whitespace and newlines until a line with non-whitespace is reached. The whitespace on that line is not consumed.

skipToNewline :: Parse StringSource

Parses and returns all characters up till the end of the line, then skips to the beginning of the next line.

parseFieldDef :: ParseDot a => a -> String -> Parse aSource

For Bool-like data structures where the presence of the field name without a value implies a default value.

commaSep' :: Parse a -> Parse b -> Parse (a, b)Source

Pre-processing of Dot code to remove comments, etc.

preProcess :: String -> StringSource

Remove unparseable features of Dot, such as comments and multi-line strings (which are converted to single-line strings).