stylist-2.7.0.1: Apply CSS styles to a document tree.
Safe HaskellNone
LanguageHaskell2010

Data.CSS.Preprocessor.Conditions.Expr

Description

Evaluates CSS media queries for import & media. INTERNAL MODULE

Synopsis

Documentation

type Expr = [Op] Source #

A parsed (post-order) expression.

data Op Source #

Operators understood by media queries.

Constructors

And

Is true if both operands are true

Or

Is true if either operand is true

Not

Is true if it's operand isn't.

Var Text

Queries the value of an externally-specified parameter.

Tok Token

Tokens to be evaluated as specified by caller.

MkRatio

Pushes a ratio value to stack, for querying screensize.

Less

Is the left operand smaller than right?

LessEq

Is the left operand smaller or the same as right?

Equal

Are the operands the same?

Greater

Is the left operand bigger than right?

GreaterEq

Is the left operand bigger or the same as right?

Instances

Instances details
Eq Op Source # 
Instance details

Defined in Data.CSS.Preprocessor.Conditions.Expr

Methods

(==) :: Op -> Op -> Bool

(/=) :: Op -> Op -> Bool

Show Op Source # 
Instance details

Defined in Data.CSS.Preprocessor.Conditions.Expr

Methods

showsPrec :: Int -> Op -> ShowS

show :: Op -> String

showList :: [Op] -> ShowS

parse :: Token -> [Token] -> (Expr, [Token]) Source #

Parses a media query to postorder form, returning the tokens after the given delimiter.

parse' :: [Token] -> [(Op, Int)] -> Expr Source #

Parses a media query to postorder form, given an operator stack.

eval :: (Text -> Datum) -> (Token -> Datum) -> Expr -> Bool Source #

Evaluates a media query with the given functions for evaluating vars & tokens.

data Datum Source #

Dynamic types for evaluating media queries.

Constructors

B Bool 
N Float 
R 

Fields

Instances

Instances details
Eq Datum Source # 
Instance details

Defined in Data.CSS.Preprocessor.Conditions.Expr

Methods

(==) :: Datum -> Datum -> Bool

(/=) :: Datum -> Datum -> Bool