{-# LANGUAGE TypeFamilies #-}
module Drasil.Shared.RendererClassesCommon (
CommonRenderSym, ImportSym(..), ImportElim(..), RenderBody(..), BodyElim(..),
RenderBlock(..), BlockElim(..), RenderType(..), VSUnOp, UnaryOpSym(..),
VSBinOp, BinaryOpSym(..), OpElim(..), RenderVariable(..), InternalVarElim(..),
InternalBinderElim(..), RenderValue(..), ValueElim(..), InternalListFunc(..),
RenderFunction(..), FunctionElim(..), InternalAssignStmt(..),
InternalIOStmt(..), InternalControlStmt(..), RenderStatement(..),
StatementElim(..), RenderVisibility(..), VisibilityElim(..), MSMthdType,
MethodTypeSym(..), RenderParam(..), ParamElim(..), RenderMethod(..),
MethodElim(..), BlockCommentSym(..), BlockCommentElim(..), ScopeElim(..)
) where
import Drasil.Shared.InterfaceCommon (Label, Library, MSBody, MSBlock, VSFunction,
VSType, SVariable, SValue, MSStatement, MSParameter, SMethod, MixedCall,
BodySym(..), BlockSym(..), TypeSym(..), VariableSym(..), VariableElim(..),
ValueSym(..), Argument(..), Literal(..), MathConstant(..), VariableValue(..),
ValueExpression(..), CommandLineArgs(..), NumericExpression(..),
BooleanExpression(..), Comparison(..), IndexTranslator(..), List(..),
InternalList(..), VectorExpression(..), StatementSym(..), AssignStatement(..),
DeclStatement(..), IOStatement(..), StringStatement(..), FunctionSym(..),
FuncAppStatement(..), CommentStatement(..), ControlStatement(..),
VisibilitySym(..), ParameterSym(..), MethodSym(..), BinderElim(..))
import Drasil.Shared.AST (AttachmentTag, Terminator, VisibilityTag, ScopeData,
TypeData, OpData, BinderD)
import Drasil.Shared.State (MS, VS)
import Control.Monad.State (State)
import Text.PrettyPrint.HughesPJ (Doc)
class (AssignStatement r, DeclStatement r, IOStatement r,
StringStatement r, FuncAppStatement r, CommentStatement r, ControlStatement
r, Argument r, Literal r, MathConstant r, VariableValue r, CommandLineArgs r,
NumericExpression r, BooleanExpression r, Comparison r, IndexTranslator r,
List r, InternalList r, VectorExpression r, VariableElim r, BinderElim r,
RenderBlock r, BlockElim r, RenderBody r, BodyElim r, InternalListFunc r,
RenderFunction r, FunctionElim r, OpElim r, RenderParam r, ParamElim r,
RenderVisibility r, VisibilityElim r, InternalAssignStmt r, InternalIOStmt r,
InternalControlStmt r, RenderStatement r, StatementElim r, RenderType r,
RenderValue r, ValueElim r, RenderVariable r, InternalVarElim r,
InternalBinderElim r, ImportSym r, ImportElim r, UnaryOpSym r, BinaryOpSym r,
BlockCommentSym r, BlockCommentElim r, ValueExpression r, RenderMethod r,
MethodElim r, ParameterSym r, ScopeElim r
) => CommonRenderSym r
class ImportSym r where
type Import r
langImport :: Label -> r (Import r)
modImport :: Label -> r (Import r)
class ImportElim r where
import' :: r (Import r) -> Doc
class RenderBody r where
multiBody :: [MSBody r] -> MSBody r
class BodyElim r where
body :: r (Body r) -> Doc
class RenderBlock r where
multiBlock :: [MSBlock r] -> MSBlock r
class BlockElim r where
block :: r (Block r) -> Doc
class RenderType r where
multiType :: [VSType r] -> VSType r
type VSUnOp a = VS (a OpData)
class UnaryOpSym r where
notOp :: VSUnOp r
negateOp :: VSUnOp r
sqrtOp :: VSUnOp r
absOp :: VSUnOp r
logOp :: VSUnOp r
lnOp :: VSUnOp r
expOp :: VSUnOp r
sinOp :: VSUnOp r
cosOp :: VSUnOp r
tanOp :: VSUnOp r
asinOp :: VSUnOp r
acosOp :: VSUnOp r
atanOp :: VSUnOp r
floorOp :: VSUnOp r
ceilOp :: VSUnOp r
type VSBinOp a = VS (a OpData)
class BinaryOpSym r where
equalOp :: VSBinOp r
notEqualOp :: VSBinOp r
greaterOp :: VSBinOp r
greaterEqualOp :: VSBinOp r
lessOp :: VSBinOp r
lessEqualOp :: VSBinOp r
plusOp :: VSBinOp r
minusOp :: VSBinOp r
multOp :: VSBinOp r
divideOp :: VSBinOp r
powerOp :: VSBinOp r
moduloOp :: VSBinOp r
andOp :: VSBinOp r
orOp :: VSBinOp r
class OpElim r where
uOp :: r OpData -> Doc
bOp :: r OpData -> Doc
uOpPrec :: r OpData -> Int
bOpPrec :: r OpData -> Int
class ScopeElim r where
scopeData :: r ScopeData -> ScopeData
class RenderVariable r where
varFromData :: AttachmentTag -> String -> VSType r -> Doc -> SVariable r
class InternalVarElim r where
variableBind :: r (Variable r) -> AttachmentTag
variable :: r (Variable r) -> Doc
class InternalBinderElim r where
binderElim :: r BinderD -> Doc
class RenderValue r where
inputFunc :: SValue r
printFunc :: SValue r
printLnFunc :: SValue r
printFileFunc :: SValue r -> SValue r
printFileLnFunc :: SValue r -> SValue r
cast :: VSType r -> SValue r -> SValue r
call :: Maybe Library -> Maybe Doc -> MixedCall r
valFromData :: Maybe Int -> Maybe Integer -> VSType r -> Doc -> SValue r
class ValueElim r where
valuePrec :: r (Value r) -> Maybe Int
valueInt :: r (Value r) -> Maybe Integer
value :: r (Value r) -> Doc
class InternalListFunc r where
listSizeFunc :: SValue r -> VSFunction r
listAddFunc :: SValue r -> SValue r -> SValue r -> VSFunction r
listAppendFunc :: SValue r -> SValue r -> VSFunction r
listAccessFunc :: VSType r -> SValue r -> VSFunction r
listSetFunc :: SValue r -> SValue r -> SValue r -> VSFunction r
class RenderFunction r where
funcFromData :: Doc -> VSType r -> VSFunction r
class FunctionElim r where
functionType :: r (Function r) -> r TypeData
function :: r (Function r) -> Doc
class InternalAssignStmt r where
multiAssign :: [SVariable r] -> [SValue r] -> MSStatement r
class InternalIOStmt r where
printSt :: Bool -> Maybe (SValue r) -> SValue r -> SValue r -> MSStatement r
class InternalControlStmt r where
multiReturn :: [SValue r] -> MSStatement r
class RenderStatement r where
stmt :: MSStatement r -> MSStatement r
loopStmt :: MSStatement r -> MSStatement r
stmtFromData :: Doc -> Terminator -> MSStatement r
class StatementElim r where
statement :: r (Statement r) -> Doc
statementTerm :: r (Statement r) -> Terminator
class RenderVisibility r where
visibilityFromData :: VisibilityTag -> Doc -> r (Visibility r)
class VisibilityElim r where
visibility :: r (Visibility r) -> Doc
class RenderParam r where
paramFromData :: SVariable r -> Doc -> MSParameter r
class ParamElim r where
parameterName :: r (Parameter r) -> Label
parameterType :: r (Parameter r) -> r TypeData
parameter :: r (Parameter r) -> Doc
class r where
:: [String] -> r Doc
:: State a [String] -> State a (r Doc)
class r where
:: r Doc -> Doc
type MSMthdType a = MS (a (MethodType a))
class (TypeSym r) => MethodTypeSym r where
type MethodType r
mType :: VSType r -> MSMthdType r
class (MethodTypeSym r, BlockCommentSym r) => RenderMethod r where
:: MS (r Doc) -> SMethod r -> SMethod r
mthdFromData :: VisibilityTag -> Doc -> SMethod r
class MethodElim r where
method :: r (Method r) -> Doc