HaSSQL-1.0.0: Haskell Simple Structured Query Language

Safe HaskellSafe
LanguageHaskell2010

ExpressionParser

Description

 
Synopsis

Documentation

data ValueExpr Source #

ValueExpr represnts a expression

Constructors

NumLit Integer

NumLit type constructor for integer constants that takes integer as argument

Iden String

Iden type constructor for identifier that takes string as argument

PrefOp String ValueExpr

PrefOp for prefix operators that takes operator(String) and a ValueExpr

BinOp ValueExpr String ValueExpr

BinOp for binary operators that takes operator(String) and two ValueExpr

Parens ValueExpr

Parens type constructor that ValueExpr as argument that is ought to be in parenthesis.

StringLit String

StringLit type constructor for string literals that takes string as argument

Star

Star for * symbol

BoolLit Bool

BoolLit type constructor for boolean constants that takes bool as argument

Instances
Eq ValueExpr Source # 
Instance details

Defined in ExpressionParser

Show ValueExpr Source # 
Instance details

Defined in ExpressionParser

data EvalType Source #

EvalType represnts a return type of evaluator

Constructors

Int Integer

EvalType holds am integral return type

Boolean Bool

Boolean holds a boolean return type

Error String

Error holds a error string

Instances
Eq EvalType Source # 
Instance details

Defined in ExpressionParser

Show EvalType Source # 
Instance details

Defined in ExpressionParser

num :: Parser ValueExpr Source #

num wraps a parsed integer literal in ValueExpr datatype

iden :: [String] -> Parser ValueExpr Source #

iden wraps a parsed identifier literal in ValueExpr datatype Argument is a blacklist

boolean :: Parser ValueExpr Source #

bolean wraps a parsed boolean literal in ValueExpr datatype

parensValue :: Parser ValueExpr Source #

parensValue wraps a parsed parenthesis expression in ValueExpr datatype

term :: [String] -> Parser ValueExpr Source #

term contains all possible expression types

table :: [[Operator Char () ValueExpr]] Source #

table contains precedence, associativity of integer and boolean operators

valueExpr :: [String] -> Parser ValueExpr Source #

valueExpr parses a given string to ValueExpr datatype Input is a blacklist

stringLit :: Parser ValueExpr Source #

stringLit wraps a parsed string literal in ValueExpr datatype

star :: Parser ValueExpr Source #

star wraps a parsed * keyword in ValueExpr datatype

evaluate :: Map String ValueExpr -> Either ParseError ValueExpr -> EvalType Source #

evaluate evaluates a parsed ValueExpr to integer EvalType if possible otherwise Exception First argument is map of variables and corresponding values. Second argument is a parsed expression type.

evaluate2 :: Map String ValueExpr -> Either ParseError ValueExpr -> EvalType Source #

evaluate2 evaluates a parsed ValueExpr to boolean EvalTypeif possible otherwise Exception First argument is map of variables and corresponding values. Second argument is a parsed expression type.

evaluateExpr :: Map String ValueExpr -> ValueExpr -> Integer Source #

evaluateExpr evaluates a ValueExpr to Integer if possible otherwise Exception First argument is map of variables and corresponding values. Second argument is a parsed expression (ValueExpr) type.

evaluateExpr2 :: Map String ValueExpr -> ValueExpr -> Bool Source #

evaluateExpr2 evaluates a ValueExpr to Bool if possible otherwise Exception First argument is map of variables and corresponding values. Second argument is a parsed expression (ValueExpr) type.