Copyright | (c) Kimiyuki Onaka 2020 |
---|---|
License | Apache License 2.0 |
Maintainer | kimiyuki95@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Expr
module has the basic data types for the standard Python.
See the Python's ast
module (https://docs.python.org/ja/3/library/ast.html#abstract-grammar) for reference.
Synopsis
- newtype Ident = Ident String
- unIdent :: Ident -> String
- type Ident' = WithLoc Ident
- data Constant
- data Statement
- = FunctionDef Ident' Arguments [Statement'] [Decorator] (Maybe Type')
- | AsyncFunctionDef Ident' Arguments [Statement'] [Decorator] (Maybe Type')
- | ClassDef Ident' [Expr'] [Keyword'] [Statement'] [Decorator]
- | Return (Maybe Expr')
- | Delete [Target']
- | Assign [Target'] Expr'
- | AugAssign Target' Operator Expr'
- | AnnAssign Target' Type' (Maybe Expr')
- | For Target' Expr' [Statement'] [Statement']
- | AsyncFor Target' Expr' [Statement'] [Statement']
- | While Expr' [Statement'] [Statement']
- | If Expr' [Statement'] [Statement']
- | With [WithItem] [Statement']
- | AsyncWith [WithItem] [Statement']
- | Raise (Maybe Expr') (Maybe Expr')
- | Try [Statement'] [ExceptHandler'] [Statement'] [Statement']
- | Assert Expr' (Maybe Expr')
- | Import [Alias]
- | ImportFrom [Ident'] [Alias]
- | Global [Ident']
- | Nonlocal [Ident']
- | Expr' Expr'
- | Pass
- | Break
- | Continue
- type Statement' = WithLoc Statement
- data Expr
- = BoolOp Expr' BoolOp Expr'
- | NamedExpr Target' Expr'
- | BinOp Expr' Operator Expr'
- | UnaryOp UnaryOp Expr'
- | Lambda Arguments Expr'
- | IfExp Expr' Expr' Expr'
- | Dict [(Maybe Expr', Expr')]
- | Set [Expr']
- | ListComp Expr' [Comprehension]
- | SetComp Expr' [Comprehension]
- | DictComp Expr' Expr' [Comprehension]
- | GeneratorExp Expr' [Comprehension]
- | Await Expr'
- | Yield (Maybe Expr')
- | YieldFrom Expr'
- | Compare Expr' [(CmpOp, Expr')]
- | Call Expr' [Expr'] [Keyword']
- | FormattedValue Expr' (Maybe Char) (Maybe Expr')
- | JoinedStr [Expr']
- | Constant Constant
- | Attribute Expr' Ident'
- | Subscript Expr' Expr'
- | Starred Expr'
- | Name Ident'
- | List [Expr']
- | Tuple [Expr']
- | Slice (Maybe Expr') (Maybe Expr') (Maybe Expr')
- type Expr' = WithLoc Expr
- type Target = Expr'
- type Target' = Expr'
- type Type = Expr'
- type Type' = Expr'
- type Decorator = Expr'
- type Decorator' = Expr'
- data ExprContext
- data BoolOp
- data Operator
- data UnaryOp
- data CmpOp
- data Comprehension = Comprehension {}
- data ExceptHandler = ExceptHandler {}
- type ExceptHandler' = WithLoc ExceptHandler
- data Arguments = Arguments {
- argsPosonlyargs :: [Arg]
- argsArgs :: [Arg]
- argsVarargs :: Maybe Arg
- argsKwonlyargs :: [Arg]
- argsKwDefaults :: [Expr']
- argsKwarg :: Maybe Arg
- argsDefaults :: [Expr']
- emptyArguments :: Arguments
- type Arg = (Ident', Maybe Type')
- type Keyword = (Maybe Ident', Expr')
- type Keyword' = WithLoc Keyword
- type Alias = (Ident', Maybe Ident')
- type WithItem = (Expr', Maybe Expr')
- type Program = [Statement']
Documentation
ConstNone | |
ConstInt Integer | |
ConstBool Bool | |
ConstString String | |
ConstBytes [Int8] | |
ConstFloat Double | |
ConstImaginary Double |
FunctionDef Ident' Arguments [Statement'] [Decorator] (Maybe Type') | |
AsyncFunctionDef Ident' Arguments [Statement'] [Decorator] (Maybe Type') | |
ClassDef Ident' [Expr'] [Keyword'] [Statement'] [Decorator] | |
Return (Maybe Expr') | |
Delete [Target'] | |
Assign [Target'] Expr' | |
AugAssign Target' Operator Expr' | |
AnnAssign Target' Type' (Maybe Expr') | |
For Target' Expr' [Statement'] [Statement'] | For target iter body orelse |
AsyncFor Target' Expr' [Statement'] [Statement'] | |
While Expr' [Statement'] [Statement'] | While test body orelse |
If Expr' [Statement'] [Statement'] | |
With [WithItem] [Statement'] | |
AsyncWith [WithItem] [Statement'] | |
Raise (Maybe Expr') (Maybe Expr') |
|
Try [Statement'] [ExceptHandler'] [Statement'] [Statement'] | Try body handlers orelse finalbody |
Assert Expr' (Maybe Expr') | Assert test msg |
Import [Alias] | |
ImportFrom [Ident'] [Alias] | |
Global [Ident'] | |
Nonlocal [Ident'] | |
Expr' Expr' | |
Pass | |
Break | |
Continue |
type Statement' = WithLoc Statement Source #
type Decorator' = Expr' Source #
data ExprContext Source #
Instances
Eq ExprContext Source # | |
Defined in Jikka.Python.Language.Expr (==) :: ExprContext -> ExprContext -> Bool # (/=) :: ExprContext -> ExprContext -> Bool # | |
Ord ExprContext Source # | |
Defined in Jikka.Python.Language.Expr compare :: ExprContext -> ExprContext -> Ordering # (<) :: ExprContext -> ExprContext -> Bool # (<=) :: ExprContext -> ExprContext -> Bool # (>) :: ExprContext -> ExprContext -> Bool # (>=) :: ExprContext -> ExprContext -> Bool # max :: ExprContext -> ExprContext -> ExprContext # min :: ExprContext -> ExprContext -> ExprContext # | |
Read ExprContext Source # | |
Defined in Jikka.Python.Language.Expr readsPrec :: Int -> ReadS ExprContext # readList :: ReadS [ExprContext] # readPrec :: ReadPrec ExprContext # readListPrec :: ReadPrec [ExprContext] # | |
Show ExprContext Source # | |
Defined in Jikka.Python.Language.Expr showsPrec :: Int -> ExprContext -> ShowS # show :: ExprContext -> String # showList :: [ExprContext] -> ShowS # |
Add | |
Sub | |
Mult | |
MatMult | |
Div | |
FloorDiv | |
FloorMod | |
CeilDiv | our extension |
CeilMod | our extension |
Pow | |
BitLShift | |
BitRShift | |
BitOr | |
BitXor | |
BitAnd | |
Max | our extension |
Min | our extension |
data Comprehension Source #
Comprehension target iter ifs is_async
Instances
Eq Comprehension Source # | |
Defined in Jikka.Python.Language.Expr (==) :: Comprehension -> Comprehension -> Bool # (/=) :: Comprehension -> Comprehension -> Bool # | |
Ord Comprehension Source # | |
Defined in Jikka.Python.Language.Expr compare :: Comprehension -> Comprehension -> Ordering # (<) :: Comprehension -> Comprehension -> Bool # (<=) :: Comprehension -> Comprehension -> Bool # (>) :: Comprehension -> Comprehension -> Bool # (>=) :: Comprehension -> Comprehension -> Bool # max :: Comprehension -> Comprehension -> Comprehension # min :: Comprehension -> Comprehension -> Comprehension # | |
Read Comprehension Source # | |
Defined in Jikka.Python.Language.Expr readsPrec :: Int -> ReadS Comprehension # readList :: ReadS [Comprehension] # | |
Show Comprehension Source # | |
Defined in Jikka.Python.Language.Expr showsPrec :: Int -> Comprehension -> ShowS # show :: Comprehension -> String # showList :: [Comprehension] -> ShowS # |
data ExceptHandler Source #
Instances
Eq ExceptHandler Source # | |
Defined in Jikka.Python.Language.Expr (==) :: ExceptHandler -> ExceptHandler -> Bool # (/=) :: ExceptHandler -> ExceptHandler -> Bool # | |
Ord ExceptHandler Source # | |
Defined in Jikka.Python.Language.Expr compare :: ExceptHandler -> ExceptHandler -> Ordering # (<) :: ExceptHandler -> ExceptHandler -> Bool # (<=) :: ExceptHandler -> ExceptHandler -> Bool # (>) :: ExceptHandler -> ExceptHandler -> Bool # (>=) :: ExceptHandler -> ExceptHandler -> Bool # max :: ExceptHandler -> ExceptHandler -> ExceptHandler # min :: ExceptHandler -> ExceptHandler -> ExceptHandler # | |
Read ExceptHandler Source # | |
Defined in Jikka.Python.Language.Expr readsPrec :: Int -> ReadS ExceptHandler # readList :: ReadS [ExceptHandler] # | |
Show ExceptHandler Source # | |
Defined in Jikka.Python.Language.Expr showsPrec :: Int -> ExceptHandler -> ShowS # show :: ExceptHandler -> String # showList :: [ExceptHandler] -> ShowS # |
type ExceptHandler' = WithLoc ExceptHandler Source #
Arguments | |
|
type Alias = (Ident', Maybe Ident') Source #
(name, asname)
. Alias
is used for Import
and ImportFrom
.
type Program = [Statement'] Source #