Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The ConditionalRestriction library offers functionality for parsing and evaluating of conditional restriction values (see OSM Wiki).
This module offers functions suitable for most basic use cases.
Synopsis
Documentation
needsData :: String -> Result ErrorMsg [(ID, Type)] Source #
Takes a conditional restriction string and returns the data needed in order to evaluate this string. If the conditional restriction couldn't be parsed, an error message is returned instead.
evaluate :: String -> [(ID, String)] -> Result ([ErrorMsg], [(ID, Type)]) (Maybe Token) Source #
Takes a conditional restriction string and some input data.
It returns the value as a token if any restriction condition was met, or Nothing
otherwise.
If there was a parsing error or a problem with the provided data, a list of error messages
and a list of needed data is returned.
parseRestriction :: String -> Result ErrorMsg ConditionalRestriction Source #
Takes a conditional restriction string and returns the corresponding AST. Take a look at the ConditionalRestriction.Parse.AST module for AST manipulation.
Input data value, corresponding to input Type
s.
VBool Bool | Boolean value, e.g. |
VNum Double | Number value, e.g. |
VTime DateTime | Time value, e.g. |
Instances
Input data type.
A single token. Is used to represent values of any kind that the parser does not touch.