Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data structures representing an abstract syntax tree for MOO code
- newtype Program = Program [Statement]
- data Statement
- = Expression !LineNo Expr
- | If !LineNo Expr Then [ElseIf] Else
- | ForList !LineNo Id Expr [Statement]
- | ForRange !LineNo Id (Expr, Expr) [Statement]
- | While !LineNo (Maybe Id) Expr [Statement]
- | Fork !LineNo (Maybe Id) Expr [Statement]
- | Break (Maybe Id)
- | Continue (Maybe Id)
- | Return !LineNo (Maybe Expr)
- | TryExcept [Statement] [Except]
- | TryFinally [Statement] Finally
- newtype Then = Then [Statement]
- data ElseIf = ElseIf !LineNo Expr [Statement]
- newtype Else = Else [Statement]
- data Except = Except !LineNo (Maybe Id) Codes [Statement]
- newtype Finally = Finally [Statement]
- data Expr
- = Literal Value
- | List [Argument]
- | Variable Id
- | PropertyRef Expr Expr
- | Assign Expr Expr
- | Scatter [ScatterItem] Expr
- | VerbCall Expr Expr [Argument]
- | BuiltinFunc Id [Argument]
- | Expr `Index` Expr
- | Expr `Range` (Expr, Expr)
- | Length
- | Expr `In` Expr
- | Expr `Plus` Expr
- | Expr `Minus` Expr
- | Expr `Times` Expr
- | Expr `Divide` Expr
- | Expr `Remain` Expr
- | Expr `Power` Expr
- | Negate Expr
- | Conditional Expr Expr Expr
- | Expr `And` Expr
- | Expr `Or` Expr
- | Not Expr
- | Expr `CompareEQ` Expr
- | Expr `CompareNE` Expr
- | Expr `CompareLT` Expr
- | Expr `CompareLE` Expr
- | Expr `CompareGT` Expr
- | Expr `CompareGE` Expr
- | Catch Expr Codes Default
- data Codes
- newtype Default = Default (Maybe Expr)
- data Argument
- data ScatterItem
- = ScatRequired Id
- | ScatOptional Id (Maybe Expr)
- | ScatRest Id
- isLValue :: Expr -> Bool
- precedence :: Expr -> Int
Data Structures
Expression !LineNo Expr | |
If !LineNo Expr Then [ElseIf] Else | |
ForList !LineNo Id Expr [Statement] | |
ForRange !LineNo Id (Expr, Expr) [Statement] | |
While !LineNo (Maybe Id) Expr [Statement] | |
Fork !LineNo (Maybe Id) Expr [Statement] | |
Break (Maybe Id) | |
Continue (Maybe Id) | |
Return !LineNo (Maybe Expr) | |
TryExcept [Statement] [Except] | |
TryFinally [Statement] Finally |
data ScatterItem Source
Show ScatterItem Source | |
VCacheable ScatterItem Source | |
Sizeable ScatterItem Source |
Utility Functions
isLValue :: Expr -> Bool Source
Can the given expression be used on the left-hand side of an assignment?
precedence :: Expr -> Int Source
Return a precedence value for the given expression, needed by MOO.Unparser to determine whether parentheses are necessary to isolate an expression from its surrounding context.