Copyright | (C) CSIRO 2017-2018 |
---|---|
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)
- data Decorator (v :: [*]) a = Decorator {
- _decoratorAnn :: 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 :: 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 :: 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 :: a
- _csIndents :: Indents a
- _unsafeCsWhileWhile :: [Whitespace]
- _unsafeCsWhileCond :: Expr v a
- _unsafeCsWhileBody :: Suite v a
- _unsafeCsWhileElse :: Maybe (Indents a, [Whitespace], Suite v a)
- | TryExcept {
- _csAnn :: 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 :: 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 :: 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 :: 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 a [Whitespace] (Maybe (Expr v a))
- | Expr a (Expr v a)
- | Assign a (Expr v a) (NonEmpty (Equals, Expr v a))
- | AugAssign a (Expr v a) (AugAssign a) (Expr v a)
- | Pass a [Whitespace]
- | Break a [Whitespace]
- | Continue a [Whitespace]
- | Global a (NonEmpty Whitespace) (CommaSep1 (Ident v a))
- | Nonlocal a (NonEmpty Whitespace) (CommaSep1 (Ident v a))
- | Del a [Whitespace] (CommaSep1' (Expr v a))
- | Import a (NonEmpty Whitespace) (CommaSep1 (ImportAs (ModuleName v) v a))
- | From a [Whitespace] (RelativeModuleName v a) [Whitespace] (ImportTargets v a)
- | Raise a [Whitespace] (Maybe (Expr v a, Maybe ([Whitespace], Expr v a)))
- | Assert a [Whitespace] (Expr v a) (Maybe (Comma, Expr v a))
- data WithItem (v :: [*]) a = WithItem {
- _withItemAnn :: a
- _withItemValue :: Expr v a
- _withItemBinder :: Maybe ([Whitespace], Expr v a)
- withItemAnn :: forall v a. Lens' (WithItem v a) 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 :: a
- _exceptAsExpr :: Expr v a
- _exceptAsName :: Maybe ([Whitespace], Ident v a)
- exceptAsAnn :: forall v a. Lens' (ExceptAs v a) 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 #
Traversal
over all the Statement
s in a term
_Statements :: Traversal (s v a) (s '[] a) (Statement v a) (Statement '[] a) Source #
Instances
HasStatements Suite 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 |
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
withItemAnn :: forall v a. Lens' (WithItem v a) a Source #
withItemValue :: forall v a. Lens' (WithItem v a) (Expr v a) Source #
withItemBinder :: forall v a. Lens' (WithItem v a) (Maybe ([Whitespace], Expr v a)) Source #
except ... as ...
data ExceptAs (v :: [*]) a Source #
ExceptAs | |
|
Instances
Lenses
exceptAsAnn :: forall v a. Lens' (ExceptAs v a) a Source #
exceptAsExpr :: forall v a. Lens' (ExceptAs v a) (Expr v a) Source #
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.
Instances
Blocks
data Block (v :: [*]) a Source #
Block | |
|
Instances
Lenses
Traversals
class HasBlocks s where Source #
_Blocks :: Traversal (s v a) (s '[] a) (Block v a) (Block '[] a) Source #
Traversal
targeting all the Block
s in a structure
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 # |