-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parsing and pretty printing of Python code. -- -- language-python is a Haskell library for parsing and pretty printing -- Python code. Currently it only supports Python version 3.0. @package language-python @version 0.1.1 -- | Source location information for the Python parser. XXX We will -- probably move to source spans at some point. module Language.Python.Data.SrcLocation -- | Types which have a source location. class Location a location :: (Location a) => a -> SrcLocation -- | A location for a syntactic entity from the source code. The location -- is specified by its filename, and starting row and column. data SrcLocation Sloc :: String -> !Int -> !Int -> SrcLocation sloc_filename :: SrcLocation -> String sloc_row :: SrcLocation -> !Int sloc_column :: SrcLocation -> !Int NoLocation :: SrcLocation -- | Construct the initial source location for a file. initialSrcLocation :: String -> SrcLocation -- | Increment the column of a location by one. incColumn :: Int -> SrcLocation -> SrcLocation -- | Increment the line number (row) of a location by one. incLine :: Int -> SrcLocation -> SrcLocation -- | Increment the column of a location by one tab stop. incTab :: SrcLocation -> SrcLocation instance Eq SrcLocation instance Ord SrcLocation instance Show SrcLocation -- | Representation of the Python version 3 abstract syntax. -- -- See: -- -- -- -- Note: there are cases where the AST is more liberal than the formal -- grammar of the language. Therefore some care must be taken when -- constructing Python programs using the raw AST. XXX At some point we -- should provide smart constructors which ensure syntactic correctness -- of the AST. module Language.Python.Version3.Syntax.AST -- | A module (Python source file). See -- http://docs.python.org/dev/3.0/reference/toplevel_components.html. newtype Module -- | A module is just a sequence of top-level statements. Module :: [Statement] -> Module -- | Identifier. newtype Ident Ident :: String -> Ident -- | A compound name constructed with the dot operator. type DottedName = [Ident] -- | Statements. -- -- See: -- -- data Statement -- | Import statement. Import :: [ImportItem] -> Statement -- | Items to import. import_items :: Statement -> [ImportItem] -- | From ... import statement. FromImport :: ImportModule -> FromItems -> Statement -- | Module to import from. from_module :: Statement -> ImportModule -- | Items to import. from_items :: Statement -> FromItems -- | While loop. See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-while-statement. While :: Expr -> Suite -> Suite -> Statement -- | Loop condition. while_cond :: Statement -> Expr -- | Loop body. while_body :: Statement -> Suite -- | Else clause. while_else :: Statement -> Suite -- | For loop. See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-for-statement. For :: [Expr] -> Expr -> Suite -> Suite -> Statement -- | Loop variables. for_targets :: Statement -> [Expr] -- | Loop generator. for_generator :: Statement -> Expr -- | Loop body for_body :: Statement -> Suite -- | Else clause. for_else :: Statement -> Suite -- | Function definition. See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#function-definitions. Fun :: Ident -> [Parameter] -> Maybe Expr -> Suite -> Statement -- | Function name. fun_name :: Statement -> Ident -- | Function parameter list. fun_args :: Statement -> [Parameter] -- | Optional result annotation. fun_result_annotation :: Statement -> Maybe Expr -- | Function body. fun_body :: Statement -> Suite -- | Class definition. See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#class-definitions. Class :: Ident -> [Argument] -> Suite -> Statement -- | Class name. class_name :: Statement -> Ident -- | Class argument list. class_args :: Statement -> [Argument] -- | Class body. class_body :: Statement -> Suite -- | Conditional statement (if-elif-else). See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-if-statement. Conditional :: [(Expr, Suite)] -> Suite -> Statement -- | Sequence of if-elif conditional clauses. cond_guards :: Statement -> [(Expr, Suite)] -- | Possibly empty unconditional else clause. cond_else :: Statement -> Suite -- | Assignment statement. See -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#assignment-statements. Assign :: [Expr] -> Expr -> Statement -- | Entity to assign to. XXX perhaps this should not be a list. assign_to :: Statement -> [Expr] -- | Expression to evaluate. assign_expr :: Statement -> Expr -- | Augmented assignment statement. See -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#augmented-assignment-statements. AugmentedAssign :: Expr -> AssignOp -> Expr -> Statement -- | Entity to assign to. aug_assign_to :: Statement -> Expr -- | Assignment operator (for example '+='). aug_assign_op :: Statement -> AssignOp -- | Expression to evaluate. aug_assign_expr :: Statement -> Expr -- | Decorated definition of a function or class. Decorated :: [Decorator] -> Statement -> Statement -- | Decorators. decorated_decorators :: Statement -> [Decorator] -- | Function or class definition to be decorated. decorated_def :: Statement -> Statement -- | Return statement (may only occur syntactically nested in a function -- definition). See -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-return-statement. Return :: Maybe Expr -> Statement -- | Optional expression to evaluate and return to caller. return_expr :: Statement -> Maybe Expr -- | Try statement (exception handling). See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-try-statement. Try :: Suite -> [Handler] -> Suite -> Suite -> Statement -- | Try clause. try_body :: Statement -> Suite -- | Exception handlers. try_excepts :: Statement -> [Handler] -- | Possibly empty else clause, executed if and when control flows off the -- end of the try clause. try_else :: Statement -> Suite -- | Possibly empty finally clause. try_finally :: Statement -> Suite -- | Raise statement (exception throwing). See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-raise-statement Raise :: Maybe (Expr, Maybe Expr) -> Statement -- | Optional expression to evaluate, and optional 'from' clause. raise_expr :: Statement -> Maybe (Expr, Maybe Expr) -- | With statement (context management). See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-with-statement. -- And also see: http://www.python.org/dev/peps/pep-0343/. With :: Expr -> Maybe Expr -> Suite -> Statement -- | Context expression (yields a context manager). with_context :: Statement -> Expr -- | Optional target. with_as :: Statement -> Maybe Expr -- | Suite to be managed. with_body :: Statement -> Suite -- | Pass statement (null operation). See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-pass-statement Pass :: Statement -- | Break statement (may only occur syntactically nested in a for or while -- loop, but not nested in a function or class definition within that -- loop). See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-break-statement. Break :: Statement -- | Continue statement (may only occur syntactically nested in a for or -- while loop, but not nested in a function or class definition or -- finally clause within that loop). See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-continue-statement. Continue :: Statement -- | Del statement (delete). See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-del-statement. Delete :: [Expr] -> Statement -- | Items to delete. del_exprs :: Statement -> [Expr] -- | Expression statement. See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#expression-statements. StmtExpr :: Expr -> Statement stmt_expr :: Statement -> Expr -- | Global declaration. See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-global-statement. Global :: [Ident] -> Statement -- | Variables declared global in the current block. global_vars :: Statement -> [Ident] -- | Nonlocal declaration. See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-nonlocal-statement. NonLocal :: [Ident] -> Statement -- | Variables declared nonlocal in the current block (their binding comes -- from bound the nearest enclosing scope). nonLocal_vars :: Statement -> [Ident] -- | Assertion. See: -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-assert-statement. Assert :: [Expr] -> Statement -- | Expressions being asserted. assert_exprs :: Statement -> [Expr] -- | A block of statements. A suite is a group of statements controlled by -- a clause, for example, the body of a loop. See -- http://docs.python.org/dev/3.0/reference/compound_stmts.html. type Suite = [Statement] -- | Formal parameter of function definitions and lambda expressions. -- -- See: -- -- data Parameter -- | Ordinary named parameter. Param :: Ident -> Maybe Expr -> Maybe Expr -> Parameter -- | Parameter name. param_name :: Parameter -> Ident -- | Optional annotation. param_annotation :: Parameter -> Maybe Expr -- | Optional default value. param_default :: Parameter -> Maybe Expr -- | Excess positional parameter (single asterisk before its name in the -- concrete syntax). VarArgsPos :: Ident -> Maybe Expr -> Parameter -- | Parameter name. param_name :: Parameter -> Ident -- | Optional annotation. param_annotation :: Parameter -> Maybe Expr -- | Excess keyword parameter (double asterisk before its name in the -- concrete syntax). VarArgsKeyword :: Ident -> Maybe Expr -> Parameter -- | Parameter name. param_name :: Parameter -> Ident -- | Optional annotation. param_annotation :: Parameter -> Maybe Expr -- | Marker for the end of positional parameters (not a parameter itself). EndPositional :: Parameter -- | Decorator. data Decorator Decorator :: DottedName -> [Argument] -> Decorator -- | Decorator name. decorator_name :: Decorator -> DottedName -- | Decorator arguments. decorator_args :: Decorator -> [Argument] -- | Augmented assignment operators. data AssignOp -- | '+=' PlusAssign :: AssignOp -- | '-=' MinusAssign :: AssignOp -- | '*=' MultAssign :: AssignOp -- | '/=' DivAssign :: AssignOp -- | '%=' ModAssign :: AssignOp -- | '*=' PowAssign :: AssignOp -- | '&=' BinAndAssign :: AssignOp -- | '|=' BinOrAssign :: AssignOp -- | '^=' BinXorAssign :: AssignOp -- | '<<=' LeftShiftAssign :: AssignOp -- | '>>=' RightShiftAssign :: AssignOp -- | '//=' FloorDivAssign :: AssignOp -- | Expression. -- -- See: http://docs.python.org/dev/3.0/reference/expressions.html. data Expr -- | Variable. Var :: Ident -> Expr -- | Literal integer. Int :: Integer -> Expr -- | Literal floating point number. Float :: Double -> Expr -- | Literal imaginary number. Imaginary :: Double -> Expr imaginary_value :: Expr -> Double -- | Literal boolean. Bool :: Bool -> Expr -- | Literal 'None' value. None :: Expr -- | Ellipsis '...'. Ellipsis :: Expr -- | Literal byte string. ByteStrings :: [ByteString] -> Expr -- | Literal strings (to be concatentated together). Strings :: [String] -> Expr -- | Function call. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#calls. Call :: Expr -> [Argument] -> Expr -- | Expression yielding a callable object (such as a function). call_fun :: Expr -> Expr -- | Call arguments. call_args :: Expr -> [Argument] -- | Subscription, for example 'x [y]'. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#id5. Subscript :: Expr -> [Expr] -> Expr subscriptee :: Expr -> Expr subscript_exprs :: Expr -> [Expr] -- | Slicing, for example 'w [x:y:z]'. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#id6. SlicedExpr :: Expr -> [Slice] -> Expr slicee :: Expr -> Expr slices :: Expr -> [Slice] -- | Conditional expresison. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#boolean-operations. CondExpr :: Expr -> Expr -> Expr -> Expr -- | Expression to evaluate if condition is True. ce_true_branch :: Expr -> Expr -- | Boolean condition. ce_condition :: Expr -> Expr -- | Expression to evaluate if condition is False. ce_false_branch :: Expr -> Expr -- | Binary operator application. BinaryOp :: Op -> Expr -> Expr -> Expr operator :: Expr -> Op left_op_arg :: Expr -> Expr right_op_arg :: Expr -> Expr -- | Unary operator application. UnaryOp :: Op -> Expr -> Expr operator :: Expr -> Op op_arg :: Expr -> Expr -- | Anonymous function definition (lambda). See: -- http://docs.python.org/dev/3.0/reference/expressions.html#id15. Lambda :: [Parameter] -> Expr -> Expr lambda_args :: Expr -> [Parameter] lambda_body :: Expr -> Expr -- | N-ary tuple of arity greater than 0. The list should not be empty. Tuple :: [Expr] -> Expr tuple_exprs :: Expr -> [Expr] -- | Generator yield. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#yield-expressions. Yield :: Maybe Expr -> Expr -- | Optional expression to yield. yield_expr :: Expr -> Maybe Expr -- | Generator. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#generator-expressions. Generator :: Comprehension Expr -> Expr gen_comprehension :: Expr -> Comprehension Expr -- | List comprehension. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#list-displays. ListComp :: Comprehension Expr -> Expr list_comprehension :: Expr -> Comprehension Expr -- | List. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#list-displays. List :: [Expr] -> Expr list_exprs :: Expr -> [Expr] -- | Dictionary. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#dictionary-displays. Dictionary :: [(Expr, Expr)] -> Expr dict_mappings :: Expr -> [(Expr, Expr)] -- | Dictionary comprehension. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#dictionary-displays. DictComp :: Comprehension (Expr, Expr) -> Expr dict_comprehension :: Expr -> Comprehension (Expr, Expr) -- | Set. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#set-displays. Set :: [Expr] -> Expr set_exprs :: Expr -> [Expr] -- | Set comprehension. -- http://docs.python.org/dev/3.0/reference/expressions.html#set-displays. SetComp :: Comprehension Expr -> Expr set_comprehension :: Expr -> Comprehension Expr -- | Starred expression. Starred :: Expr -> Expr starred_expr :: Expr -> Expr -- | Operators. data Op -- | 'and' And :: Op -- | 'or' Or :: Op -- | 'not' Not :: Op -- | '**' Exponent :: Op -- | '<' LessThan :: Op -- | '>' GreaterThan :: Op -- | '==' Equality :: Op -- | '>=' GreaterThanEquals :: Op -- | '<=' LessThanEquals :: Op -- | '!=' NotEquals :: Op -- | 'in' In :: Op -- | 'is' Is :: Op -- | 'is not' IsNot :: Op -- | 'not in' NotIn :: Op -- | '|' BinaryOr :: Op -- | '^' Xor :: Op -- | '&' BinaryAnd :: Op -- | '<<' ShiftLeft :: Op -- | '>>' ShiftRight :: Op -- | '*' Multiply :: Op -- | '+' Plus :: Op -- | '-' Minus :: Op -- | '/' Divide :: Op -- | '//' FloorDivide :: Op -- | '~' (bitwise inversion of its integer argument) Invert :: Op -- | '%' Modulo :: Op -- | '.' Dot :: Op -- | Arguments to function calls, class declarations and decorators. data Argument -- | Ordinary argument expression. ArgExpr :: Expr -> Argument arg_expr :: Argument -> Expr -- | Excess positional argument. ArgVarArgsPos :: Expr -> Argument arg_expr :: Argument -> Expr -- | Excess keyword argument. ArgVarArgsKeyword :: Expr -> Argument arg_expr :: Argument -> Expr -- | Keyword argument. ArgKeyword :: Ident -> Expr -> Argument -- | Keyword name. arg_keyword :: Argument -> Ident arg_expr :: Argument -> Expr data Slice SliceProper :: Maybe Expr -> Maybe Expr -> Maybe (Maybe Expr) -> Slice slice_lower :: Slice -> Maybe Expr slice_upper :: Slice -> Maybe Expr slice_stride :: Slice -> Maybe (Maybe Expr) SliceExpr :: Expr -> Slice slice_expr :: Slice -> Expr -- | An entity imported using the 'import' keyword. See -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-import-statement. data ImportItem ImportItem :: DottedName -> Maybe Ident -> ImportItem -- | The name of module to import. import_item_name :: ImportItem -> DottedName -- | An optional name to refer to the entity (the 'as' name). import_as_name :: ImportItem -> Maybe Ident -- | An entity imported using the 'from ... import' construct. See -- http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-import-statement data FromItem FromItem :: Ident -> Maybe Ident -> FromItem -- | The name of the entity imported. from_item_name :: FromItem -> Ident -- | An optional name to refer to the entity (the 'as' name). from_as_name :: FromItem -> Maybe Ident -- | Items imported using the 'from ... import' construct. data FromItems -- | Import everything exported from the module. ImportEverything :: FromItems -- | Import a specific list of items from the module. FromItems :: [FromItem] -> FromItems -- | A reference to the module to import from using the 'from ... import' -- construct. data ImportModule -- | Relative import. A dot followed by something. ImportRelative :: ImportModule -> ImportModule -- | Relative import. Dot on its own. ImportDot :: ImportModule -- | The name of the module to import from. ImportName :: DottedName -> ImportModule -- | Exception handler. See: -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-try-statement. type Handler = (ExceptClause, Suite) -- | Exception clause. See: -- http://docs.python.org/dev/3.0/reference/compound_stmts.html#the-try-statement. type ExceptClause = Maybe (Expr, Maybe Ident) -- | Comprehension. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#displays-for-lists-sets-and-dictionaries data Comprehension e Comprehension :: e -> CompFor -> Comprehension e comprehension_expr :: Comprehension e -> e comprehension_for :: Comprehension e -> CompFor -- | Comprehension 'for' component. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#displays-for-lists-sets-and-dictionaries data CompFor CompFor :: [Expr] -> Expr -> Maybe CompIter -> CompFor comp_for_exprs :: CompFor -> [Expr] comp_in_expr :: CompFor -> Expr comp_for_iter :: CompFor -> Maybe CompIter -- | Comprehension guard. See: -- http://docs.python.org/dev/3.0/reference/expressions.html#displays-for-lists-sets-and-dictionaries. data CompIf CompIf :: Expr -> Maybe CompIter -> CompIf comp_if :: CompIf -> Expr comp_if_iter :: CompIf -> Maybe CompIter -- | Comprehension iterator (either a 'for' or an 'if'). See: -- http://docs.python.org/dev/3.0/reference/expressions.html#displays-for-lists-sets-and-dictionaries. data CompIter IterFor :: CompFor -> CompIter IterIf :: CompIf -> CompIter instance Eq AssignOp instance Show AssignOp instance Eq Op instance Show Op instance Show Slice instance Show Expr instance Show CompIter instance Show CompIf instance Show CompFor instance (Show e) => Show (Comprehension e) instance Show Argument instance Show Parameter instance Show Decorator instance Show Statement instance Show ImportModule instance Show FromItems instance Show FromItem instance Show ImportItem instance Show Module -- | Pretty printing of the Python version 3 abstract syntax. XXX not quite -- complete. module Language.Python.Version3.Syntax.Pretty -- | All types which can be transformed into a Doc. class Pretty a pretty :: (Pretty a) => a -> Doc -- | Transform values into strings. prettyText :: (Pretty a) => a -> String -- | Conditionally wrap parentheses around an item. parensIf :: (Pretty a) => (a -> Bool) -> a -> Doc -- | A list of things separated by commas. commaList :: (Pretty a) => [a] -> Doc prettyString :: String -> Doc dot :: Doc prettyDottedName :: DottedName -> Doc prettySuite :: [Statement] -> Doc optionalKeywordSuite :: String -> [Statement] -> Doc prettyArgList :: [Argument] -> Doc prettyOptionalArgList :: [Argument] -> Doc prettyGuards :: [(Expr, Suite)] -> Doc indent :: Doc -> Doc blankLine :: Doc prettyHandlers :: [Handler] -> Doc prettyHandler :: Handler -> Doc prettyExceptClause :: ExceptClause -> Doc instance Pretty AssignOp instance Pretty Op instance Pretty Slice instance Pretty Expr instance Pretty CompIter instance Pretty CompIf instance Pretty CompFor instance (Pretty a) => Pretty (Comprehension a) instance Pretty Argument instance Pretty Parameter instance Pretty Decorator instance Pretty Statement instance Pretty ImportModule instance Pretty FromItems instance Pretty FromItem instance Pretty ImportItem instance Pretty Ident instance Pretty Module instance (Pretty a) => Pretty (Maybe a) instance Pretty Bool instance Pretty Double instance Pretty Integer instance Pretty Int instance Pretty ByteString -- | A lexer and set of tokens for Python version 3 programs. See: -- http://docs.python.org/dev/3.0/reference/lexical_analysis.html. module Language.Python.Version3.Lexer -- | Parse a string into a list of Python Tokens, or return an error. lex :: String -> String -> Either ParseError [Token] -- | Try to lex the first token in an input string. Return either a parse -- error or a pair containing the next token and the rest of the input -- after the token. lexOneToken :: String -> String -> Either ParseError (Token, String) -- | Lexical tokens. data Token -- | Indentation: increase. Indent :: SrcLocation -> Token -- | Indentation: decrease. Dedent :: SrcLocation -> Token -- | Newline. Newline :: SrcLocation -> Token -- | Identifier. Identifier :: SrcLocation -> !String -> Token -- | Literal: string. String :: SrcLocation -> !String -> Token -- | Literal: byte string. ByteString :: SrcLocation -> !ByteString -> Token -- | Literal: integer. Integer :: SrcLocation -> !Integer -> Token -- | Literal: floating point. Float :: SrcLocation -> !Double -> Token -- | Literal: imaginary number. Imaginary :: SrcLocation -> !Double -> Token -- | Keyword: 'def'. Def :: SrcLocation -> Token -- | Keyword: 'while'. While :: SrcLocation -> Token -- | Keyword: 'if'. If :: SrcLocation -> Token -- | Keyword: 'True'. True :: SrcLocation -> Token -- | Keyword: 'False'. False :: SrcLocation -> Token -- | Keyword: 'Return'. Return :: SrcLocation -> Token -- | Keyword: 'try'. Try :: SrcLocation -> Token -- | Keyword: 'except'. Except :: SrcLocation -> Token -- | Keyword: 'raise'. Raise :: SrcLocation -> Token -- | Keyword: 'in'. In :: SrcLocation -> Token -- | Keyword: 'is'. Is :: SrcLocation -> Token -- | Keyword: 'lambda'. Lambda :: SrcLocation -> Token -- | Keyword: 'class'. Class :: SrcLocation -> Token -- | Keyword: 'finally'. Finally :: SrcLocation -> Token -- | Keyword: 'None' None :: SrcLocation -> Token -- | Keyword: 'for'. For :: SrcLocation -> Token -- | Keyword: 'from'. From :: SrcLocation -> Token -- | Keyword: 'nonlocal'. NonLocal :: SrcLocation -> Token -- | Keyword: 'global'. Global :: SrcLocation -> Token -- | Keyword: 'with'. With :: SrcLocation -> Token -- | Keyword: 'as'. As :: SrcLocation -> Token -- | Keyword: 'elif'. Elif :: SrcLocation -> Token -- | Keyword: 'yield'. Yield :: SrcLocation -> Token -- | Keyword: 'assert'. Assert :: SrcLocation -> Token -- | Keyword: 'import'. Import :: SrcLocation -> Token -- | Keyword: 'pass'. Pass :: SrcLocation -> Token -- | Keyword: 'break'. Break :: SrcLocation -> Token -- | Keyword: 'continue'. Continue :: SrcLocation -> Token -- | Keyword: 'del'. Delete :: SrcLocation -> Token -- | Keyword: 'else'. Else :: SrcLocation -> Token -- | Keyword: 'not'. Not :: SrcLocation -> Token -- | Keyword: boolean conjunction 'and'. And :: SrcLocation -> Token -- | Keyword: boolean disjunction 'or'. Or :: SrcLocation -> Token -- | Delimiter: at sign '@'. At :: SrcLocation -> Token -- | Delimiter: left round bracket '('. LeftRoundBracket :: SrcLocation -> Token -- | Delimiter: right round bracket ')'. RightRoundBracket :: SrcLocation -> Token -- | Delimiter: left square bracket '['. LeftSquareBracket :: SrcLocation -> Token -- | Delimiter: right square bracket ']'. RightSquareBracket :: SrcLocation -> Token -- | Delimiter: left curly bracket '{'. LeftBrace :: SrcLocation -> Token -- | Delimiter: right curly bracket '}'. RightBrace :: SrcLocation -> Token -- | Delimiter: dot (full stop) '.'. Dot :: SrcLocation -> Token -- | Delimiter: comma ','. Comma :: SrcLocation -> Token -- | Delimiter: semicolon ';'. SemiColon :: SrcLocation -> Token -- | Delimiter: colon ':'. Colon :: SrcLocation -> Token -- | Delimiter: ellipses (three dots) '...'. Ellipsis :: SrcLocation -> Token -- | Delimiter: right facing arrow '->'. RightArrow :: SrcLocation -> Token -- | Delimiter: assignment '='. Assign :: SrcLocation -> Token -- | Delimiter: plus assignment '+='. PlusAssign :: SrcLocation -> Token -- | Delimiter: minus assignment '-='. MinusAssign :: SrcLocation -> Token -- | Delimiter: multiply assignment '*=' MultAssign :: SrcLocation -> Token -- | Delimiter: divide assignment '/='. DivAssign :: SrcLocation -> Token -- | Delimiter: modulus assignment '%='. ModAssign :: SrcLocation -> Token -- | Delimiter: power assignment '**='. PowAssign :: SrcLocation -> Token -- | Delimiter: binary-and assignment '&='. BinAndAssign :: SrcLocation -> Token -- | Delimiter: binary-or assignment '|='. BinOrAssign :: SrcLocation -> Token -- | Delimiter: binary-xor assignment '^='. BinXorAssign :: SrcLocation -> Token -- | Delimiter: binary-left-shift assignment '<<='. LeftShiftAssign :: SrcLocation -> Token -- | Delimiter: binary-right-shift assignment '>>='. RightShiftAssign :: SrcLocation -> Token -- | Delimiter: floor-divide assignment '='. FloorDivAssign :: SrcLocation -> Token -- | Operator: plus '+'. Plus :: SrcLocation -> Token -- | Operator: minus: '-'. Minus :: SrcLocation -> Token -- | Operator: multiply '*'. Mult :: SrcLocation -> Token -- | Operator: divide '/'. Div :: SrcLocation -> Token -- | Operator: greater-than '>'. GreaterThan :: SrcLocation -> Token -- | Operator: less-than '<'. LessThan :: SrcLocation -> Token -- | Operator: equals '=='. Equality :: SrcLocation -> Token -- | Operator: greater-than-or-equals '>='. GreaterThanEquals :: SrcLocation -> Token -- | Operator: less-than-or-equals '<='. LessThanEquals :: SrcLocation -> Token -- | Operator: exponential '**'. Exponent :: SrcLocation -> Token -- | Operator: binary-or '|'. BinaryOr :: SrcLocation -> Token -- | Operator: binary-xor '^'. Xor :: SrcLocation -> Token -- | Operator: binary-and '&'. BinaryAnd :: SrcLocation -> Token -- | Operator: binary-shift-left '<<'. ShiftLeft :: SrcLocation -> Token -- | Operator: binary-shift-right '>>'. ShiftRight :: SrcLocation -> Token -- | Operator: modulus '%'. Modulo :: SrcLocation -> Token -- | Operator: floor-divide ''. FloorDiv :: SrcLocation -> Token -- | Operator: tilde '~'. Tilde :: SrcLocation -> Token -- | Operator: not-equals '!='. NotEquals :: SrcLocation -> Token -- | End of file (no source location). EOF :: Token -- | Parse error. A list of error messages and a source location. newtype ParseError ParseError :: ([String], SrcLocation) -> ParseError -- | A parser for Python version 3 programs. Parsers are provided for -- modules, statements, and expressions. -- -- See: -- -- module Language.Python.Version3.Parser -- | Parse a whole Python source file. parseModule :: String -> String -> Either ParseError Module -- | Parse one compound statement, or a sequence of simple statements. -- Generally used for interactive input, such as from the command line of -- an interpreter. parseStmt :: String -> String -> Either ParseError [Statement] -- | Parse an expression. Generally used as input for the 'eval' primitive. parseExpr :: String -> String -> Either ParseError Expr -- | Parse error. A list of error messages and a source location. newtype ParseError ParseError :: ([String], SrcLocation) -> ParseError