symantic-parser-0.0.0.20210102: Parser combinators statically optimized and staged via typed meta-programming
Safe HaskellNone
LanguageHaskell2010

Symantic.Parser.Grammar.Fixity

Synopsis

Type Fixity

data Fixity Source #

Constructors

Fixity1 Unifix 
Fixity2 Infix 

Instances

Instances details
Eq Fixity Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Methods

(==) :: Fixity -> Fixity -> Bool #

(/=) :: Fixity -> Fixity -> Bool #

Show Fixity Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

PrecedenceOf Fixity Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Type Unifix

data Unifix Source #

Instances

Instances details
Eq Unifix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Methods

(==) :: Unifix -> Unifix -> Bool #

(/=) :: Unifix -> Unifix -> Bool #

Show Unifix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

PrecedenceOf Unifix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Type Infix

data Infix Source #

Instances

Instances details
Eq Infix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Methods

(==) :: Infix -> Infix -> Bool #

(/=) :: Infix -> Infix -> Bool #

Show Infix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Methods

showsPrec :: Int -> Infix -> ShowS #

show :: Infix -> String #

showList :: [Infix] -> ShowS #

PrecedenceOf Infix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

isPairNeeded :: (Infix, Side) -> Infix -> Bool Source #

Given Precedence and Associativity of its parent operator, and the operand Side it is in, return whether an Infix operator needs to be enclosed by a Pair.

pairIfNeeded :: Semigroup s => IsString s => Pair -> (Infix, Side) -> Infix -> s -> s Source #

If isPairNeeded is True, enclose the given IsString by given Pair, otherwise returns the same IsString.

Type Precedence

Class PrecedenceOf

class PrecedenceOf a where Source #

Methods

precedence :: a -> Precedence Source #

Instances

Instances details
PrecedenceOf Infix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

PrecedenceOf Unifix Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

PrecedenceOf Fixity Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Type Associativity

data Associativity Source #

Constructors

AssocL

Associate to the left: a ¹ b ² c == (a ¹ b) ² c

AssocR

Associate to the right: a ¹ b ² c == a ¹ (b ² c)

AssocB Side

Associate to both sides, but to Side when reading.

Type Side

data Side Source #

Constructors

SideL

Left

SideR

Right

Instances

Instances details
Eq Side Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Methods

(==) :: Side -> Side -> Bool #

(/=) :: Side -> Side -> Bool #

Show Side Source # 
Instance details

Defined in Symantic.Parser.Grammar.Fixity

Methods

showsPrec :: Int -> Side -> ShowS #

show :: Side -> String #

showList :: [Side] -> ShowS #

Type Pair