Copyright | (C) CSIRO 2017-2019 |
---|---|
License | BSD3 |
Maintainer | Isaac Elliott <isaace71295@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data Statement (v :: [*]) a
- = SmallStatement (Indents a) (SmallStatement v a)
- | CompoundStatement (CompoundStatement v a)
- class HasStatements s where
- _Statements :: Traversal (s v a) (s '[] a) (Statement v a) (Statement '[] a)
- class HasStatements s => HasStatements1 s where
- _Statements1 :: Traversal1 (s v a) (s '[] a) (Statement v a) (Statement '[] a)
- data Decorator (v :: [*]) a = Decorator {
- _decoratorAnn :: Ann a
- _decoratorIndents :: Indents a
- _decoratorAt :: At
- _decoratorExpr :: Expr v a
- _decoratorComment :: Maybe (Comment a)
- _decoratorNewline :: Newline
- _decoratorBlankLines :: [(Blank a, Newline)]
- data CompoundStatement (v :: [*]) a
- = Fundef {
- _csAnn :: Ann a
- _unsafeCsFundefDecorators :: [Decorator v a]
- _csIndents :: Indents a
- _unsafeCsFundefAsync :: Maybe (NonEmpty Whitespace)
- _unsafeCsFundefDef :: NonEmpty Whitespace
- _unsafeCsFundefName :: Ident v a
- _unsafeCsFundefLeftParen :: [Whitespace]
- _unsafeCsFundefParameters :: CommaSep (Param v a)
- _unsafeCsFundefRightParen :: [Whitespace]
- _unsafeCsFundefReturnType :: Maybe ([Whitespace], Expr v a)
- _unsafeCsFundefBody :: Suite v a
- | If {
- _csAnn :: Ann a
- _csIndents :: Indents a
- _unsafeCsIfIf :: [Whitespace]
- _unsafeCsIfCond :: Expr v a
- _unsafeCsIfBody :: Suite v a
- _unsafeCsIfElifs :: [(Indents a, [Whitespace], Expr v a, Suite v a)]
- _unsafeCsIfElse :: Maybe (Indents a, [Whitespace], Suite v a)
- | While {
- _csAnn :: Ann a
- _csIndents :: Indents a
- _unsafeCsWhileWhile :: [Whitespace]
- _unsafeCsWhileCond :: Expr v a
- _unsafeCsWhileBody :: Suite v a
- _unsafeCsWhileElse :: Maybe (Indents a, [Whitespace], Suite v a)
- | TryExcept {
- _csAnn :: Ann a
- _csIndents :: Indents a
- _unsafeCsTryExceptTry :: [Whitespace]
- _unsafeCsTryExceptBody :: Suite v a
- _unsafeCsTryExceptExcepts :: NonEmpty (Indents a, [Whitespace], Maybe (ExceptAs v a), Suite v a)
- _unsafeCsTryExceptElse :: Maybe (Indents a, [Whitespace], Suite v a)
- _unsafeCsTryExceptFinally :: Maybe (Indents a, [Whitespace], Suite v a)
- | TryFinally { }
- | For {
- _csAnn :: Ann a
- _csIndents :: Indents a
- _unsafeCsForAsync :: Maybe (NonEmpty Whitespace)
- _unsafeCsForFor :: [Whitespace]
- _unsafeCsForBinder :: Expr v a
- _unsafeCsForIn :: [Whitespace]
- _unsafeCsForCollection :: CommaSep1' (Expr v a)
- _unsafeCsForBody :: Suite v a
- _unsafeCsForElse :: Maybe (Indents a, [Whitespace], Suite v a)
- | ClassDef {
- _csAnn :: Ann a
- _unsafeCsClassDefDecorators :: [Decorator v a]
- _csIndents :: Indents a
- _unsafeCsClassDefClass :: NonEmpty Whitespace
- _unsafeCsClassDefName :: Ident v a
- _unsafeCsClassDefArguments :: Maybe ([Whitespace], Maybe (CommaSep1' (Arg v a)), [Whitespace])
- _unsafeCsClassDefBody :: Suite v a
- | With {
- _csAnn :: Ann a
- _csIndents :: Indents a
- _unsafeCsWithAsync :: Maybe (NonEmpty Whitespace)
- _unsafeCsWithWith :: [Whitespace]
- _unsafeCsWithItems :: CommaSep1 (WithItem v a)
- _unsafeCsWithBody :: Suite v a
- = Fundef {
- data SmallStatement (v :: [*]) a = MkSmallStatement (SimpleStatement v a) [(Semicolon a, SimpleStatement v a)] (Maybe (Semicolon a)) (Maybe (Comment a)) (Maybe Newline)
- data SimpleStatement (v :: [*]) a
- = Return (Ann a) [Whitespace] (Maybe (Expr v a))
- | Expr (Ann a) (Expr v a)
- | Assign (Ann a) (Expr v a) (NonEmpty (Equals, Expr v a))
- | AugAssign (Ann a) (Expr v a) (AugAssign a) (Expr v a)
- | Pass (Ann a) [Whitespace]
- | Break (Ann a) [Whitespace]
- | Continue (Ann a) [Whitespace]
- | Global (Ann a) (NonEmpty Whitespace) (CommaSep1 (Ident v a))
- | Nonlocal (Ann a) (NonEmpty Whitespace) (CommaSep1 (Ident v a))
- | Del (Ann a) [Whitespace] (CommaSep1' (Expr v a))
- | Import (Ann a) (NonEmpty Whitespace) (CommaSep1 (ImportAs ModuleName v a))
- | From (Ann a) [Whitespace] (RelativeModuleName v a) [Whitespace] (ImportTargets v a)
- | Raise (Ann a) [Whitespace] (Maybe (Expr v a, Maybe ([Whitespace], Expr v a)))
- | Assert (Ann a) [Whitespace] (Expr v a) (Maybe (Comma, Expr v a))
- data WithItem (v :: [*]) a = WithItem {
- _withItemAnn :: Ann a
- _withItemValue :: Expr v a
- _withItemBinder :: Maybe ([Whitespace], Expr v a)
- withItemAnn :: forall v a. Lens' (WithItem v a) (Ann a)
- withItemValue :: forall v a. Lens' (WithItem v a) (Expr v a)
- withItemBinder :: forall v a. Lens' (WithItem v a) (Maybe ([Whitespace], Expr v a))
- data ExceptAs (v :: [*]) a = ExceptAs {
- _exceptAsAnn :: Ann a
- _exceptAsExpr :: Expr v a
- _exceptAsName :: Maybe ([Whitespace], Ident v a)
- exceptAsAnn :: forall v a. Lens' (ExceptAs v a) (Ann a)
- exceptAsExpr :: forall v a. Lens' (ExceptAs v a) (Expr v a)
- exceptAsName :: forall v a. Lens' (ExceptAs v a) (Maybe ([Whitespace], Ident v a))
- data Suite (v :: [*]) a
- data Block (v :: [*]) a = Block {
- _blockBlankLines :: [(Blank a, Newline)]
- _blockHead :: Statement v a
- _blockTail :: [Either (Blank a, Newline) (Statement v a)]
- blockBlankLines :: forall v a. Lens' (Block v a) [(Blank a, Newline)]
- blockHead :: forall v a. Lens' (Block v a) (Statement v a)
- blockTail :: forall v a. Lens' (Block v a) [Either (Blank a, Newline) (Statement v a)]
- class HasBlocks s where
Statements
data Statement (v :: [*]) a Source #
A Statement
is either a SmallStatement
or a Statement
https://docs.python.org/3.5/reference/compound_stmts.html#compound-statements
SmallStatement (Indents a) (SmallStatement v a) | |
CompoundStatement (CompoundStatement v a) |
Instances
Traversals
class HasStatements s where Source #
Instances
HasStatements Suite Source # | |
Defined in Language.Python.Syntax.Statement | |
HasStatements Statement Source # | |
Defined in Language.Python.Syntax.Statement | |
HasStatements Block Source # | |
Defined in Language.Python.Syntax.Statement | |
HasStatements Module Source # | |
Defined in Language.Python.Syntax.Module | |
HasStatements Line Source # | |
Defined in Language.Python.DSL |
class HasStatements s => HasStatements1 s where Source #
_Statements1 :: Traversal1 (s v a) (s '[] a) (Statement v a) (Statement '[] a) Source #
Instances
HasStatements1 Statement Source # | |
Defined in Language.Python.Syntax.Statement _Statements1 :: Traversal1 (Statement v a) (Statement [] a) (Statement v a) (Statement [] a) Source # | |
HasStatements1 Block Source # | |
Defined in Language.Python.Syntax.Statement _Statements1 :: Traversal1 (Block v a) (Block [] a) (Statement v a) (Statement [] a) Source # |
Decorators
data Decorator (v :: [*]) a Source #
Decorators on function definitions
https://docs.python.org/3.5/reference/compound_stmts.html#function-definitions
Decorator | |
|
Instances
Compound statements
data CompoundStatement (v :: [*]) a Source #
Instances
Small statements
data SmallStatement (v :: [*]) a Source #
See simpl_stmt
at https://docs.python.org/3.5/reference/grammar.html. The grammar
has the terminology mixed up - it should really be called small_stmt
there.
MkSmallStatement (SimpleStatement v a) [(Semicolon a, SimpleStatement v a)] (Maybe (Semicolon a)) (Maybe (Comment a)) (Maybe Newline) |
Instances
Simple statements
data SimpleStatement (v :: [*]) a Source #
Instances
with ... as ...
data WithItem (v :: [*]) a Source #
WithItem | |
|
Instances
Lenses
withItemBinder :: forall v a. Lens' (WithItem v a) (Maybe ([Whitespace], Expr v a)) Source #
except ... as ...
data ExceptAs (v :: [*]) a Source #
ExceptAs | |
|
Instances
Lenses
exceptAsName :: forall v a. Lens' (ExceptAs v a) (Maybe ([Whitespace], Ident v a)) Source #
Suites
data Suite (v :: [*]) a Source #
A compound statement consists of one or more clauses. A clause consists of a header and a suite.
SuiteOne (Ann a) Colon (SmallStatement v a) | |
SuiteMany (Ann a) Colon (Maybe (Comment a)) Newline (Block v a) |
Instances
Blocks
data Block (v :: [*]) a Source #
Block | |
|
Instances
Lenses
Traversals
class HasBlocks s where Source #
Instances
HasBlocks CompoundStatement Source # | |
Defined in Language.Python.Syntax.Statement _Blocks :: Traversal (CompoundStatement v a) (CompoundStatement [] a) (Block v a) (Block [] a) Source # | |
HasBlocks Suite Source # | |
HasBlocks Statement Source # | |
HasBlocks SmallStatement Source # | |
Defined in Language.Python.Syntax.Statement _Blocks :: Traversal (SmallStatement v a) (SmallStatement [] a) (Block v a) (Block [] a) Source # |