conditional-restriction-parser-0.1.0.5: Parser and interpreter of OpenStreetMap conditional restriction values
Safe HaskellSafe-Inferred
LanguageHaskell2010

ConditionalRestriction.Parse.AST

Description

AST for conditional restrictions and incomplete AST for opening hours.

Synopsis

Documentation

type Token = String Source #

A single token. Is used to represent values of any kind that the parser does not touch.

data Expression Source #

AST representation of a conditional restriction expression, containing a value and conditions for that value

Constructors

Expression 

Fields

  • Token

    The value

  • [Condition]

    The conditions. All conditions must be met when evaluating.

Instances

Instances details
Show Expression Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

Eq Expression Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

data Condition Source #

AST representation of a condition.

Constructors

OH OpeningHours

An OpeningHours condition. When evaluating, the given time must be within those opening hours.

Comparison Token ComparisonOp Double

A comparison. Looks something like "weight > 3.0"

Absolute Token

An absolute condition, e.g. "wet", "disabled".

Instances

Instances details
Show Condition Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

Eq Condition Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

data ComparisonOp Source #

A comparison operator.

Constructors

Gt 
Lt 
GtEq 
LtEq 
Eq 

newtype OpeningHours Source #

AST representation of opening hours. Not complete.

Constructors

OpeningHours [RuleSequence] 

type OHState = Maybe Bool Source #

Opening hour state. True/False if known to be open/closed, Nothing if unknown.

data RuleType Source #

Type of opening hour rule.

Constructors

Normal

First rule or rules separated by ";".

Additional

Rules separated by ",".

Instances

Instances details
Show RuleType Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

Eq RuleType Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

data RuleSequence Source #

AST representation of a rule sequence.

type WeekdaySelector = [WeekdayRange] Source #

AST representation of a weekday selector (e.g. "Sa-Di, Th").

type TimeSelector = [TimeSpan] Source #

AST representation of a time selector (e.g. "18:00-20:00, 21:00-03:00").

data SelectorSequence Source #

AST representation of a selector sequence (e.g. "24/7", "We-Su 18:00-20:00").

data WeekdayRange Source #

AST representation of a weekday range.

data TimeSpan Source #

AST representation of time span.

Instances

Instances details
Show TimeSpan Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST

Eq TimeSpan Source # 
Instance details

Defined in ConditionalRestriction.Parse.AST