hpython-0.1: Syntax tree and DSL for Python

Copyright(C) CSIRO 2017-2018
LicenseBSD3
MaintainerIsaac Elliott <isaace71295@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Language.Python.Internal.Parse

Contents

Description

 
Synopsis

Documentation

type Parser = Parsec Void PyTokens Source #

runParser Source #

Arguments

:: AsParseError e (PyToken SrcInfo) 
=> FilePath

File name

-> Parser a

Parser

-> [PyToken SrcInfo]

Input to parse

-> Either e a 

Run a parser on some input

Stream type

newtype PyTokens Source #

Constructors

PyTokens 
Instances
Eq PyTokens Source # 
Instance details

Defined in Language.Python.Internal.Parse

Ord PyTokens Source # 
Instance details

Defined in Language.Python.Internal.Parse

Stream PyTokens Source # 
Instance details

Defined in Language.Python.Internal.Parse

Associated Types

type Token PyTokens :: Type

type Tokens PyTokens :: Type

type Token PyTokens Source # 
Instance details

Defined in Language.Python.Internal.Parse

type Token PyTokens = PyToken SrcInfo
type Tokens PyTokens Source # 
Instance details

Defined in Language.Python.Internal.Parse

type Tokens PyTokens = PyTokens

Errors

class AsParseError s t | s -> t where Source #

Instances
AsParseError (ParseError a) (PyToken a) Source # 
Instance details

Defined in Language.Python.Parse.Error

unsafeFromParseError :: (HasCallStack, AsParseError s t) => ParseError t e -> s Source #

Convert a concrete ParseError to a value that has an instance of AsParseError

This function is partial because our parser will never use FancyError

Parsers

token :: MonadParsec e PyTokens m => m Whitespace -> (PyToken SrcInfo -> Bool) -> String -> m (PyToken SrcInfo, [Whitespace]) Source #

Symbols

at :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, At) Source #

colon :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, Colon) Source #

comma :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, Comma) Source #

dot :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, Dot) Source #

doubleStar :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, [Whitespace]) Source #

equals :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, Equals) Source #

rightParen :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, [Whitespace]) Source #

star :: MonadParsec e PyTokens m => m Whitespace -> m (PyToken SrcInfo, [Whitespace]) Source #

Atomic forms

identifier :: MonadParsec e PyTokens m => m Whitespace -> m (Ident '[] SrcInfo) Source #

bool :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

none :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

ellipsis :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

integer :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

float :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

imag :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

stringOrBytes :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

Compound forms

arg :: MonadParsec e PyTokens m => m (Arg SrcInfo) Source #

binOp :: MonadParsec e PyTokens m => m (BinOp SrcInfo) -> m (Expr SrcInfo) -> m (Expr SrcInfo) Source #

commaSep :: MonadParsec e PyTokens m => m Whitespace -> m a -> m (CommaSep a) Source #

commaSep1 :: MonadParsec e PyTokens m => m Whitespace -> m a -> m (CommaSep1 a) Source #

commaSep1' :: MonadParsec e PyTokens m => m Whitespace -> m a -> m (CommaSep1' a) Source #

commaSepRest :: MonadParsec e PyTokens m => m b -> m ([(Comma, b)], Maybe Comma) Source #

compIf :: MonadParsec e PyTokens m => m (CompIf SrcInfo) Source #

compFor :: MonadParsec e PyTokens m => m (CompFor SrcInfo) Source #

decorator :: MonadParsec e PyTokens m => Indents SrcInfo -> m (Decorator SrcInfo) Source #

decoratorValue :: MonadParsec e PyTokens m => m (Expr SrcInfo) Source #

expr :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

exprList :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

exprListComp :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

exprNoCond :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

exprComp :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

exprOrStarList :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

lambda :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

lambdaNoCond :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

module_ :: MonadParsec e PyTokens m => m (Module SrcInfo) Source #

orExpr :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

orExprList :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

orTest :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

someParams :: MonadParsec e PyTokens m => m (Param SrcInfo) -> m (Param SrcInfo) -> m (Param SrcInfo) -> m (CommaSep (Param SrcInfo)) Source #

starExpr :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

suite :: MonadParsec e PyTokens m => m (Suite SrcInfo) Source #

tpPositional :: MonadParsec e PyTokens m => m (Param SrcInfo) Source #

tpStar :: MonadParsec e PyTokens m => m (Param SrcInfo) Source #

tpDoubleStar :: MonadParsec e PyTokens m => m (Param SrcInfo) Source #

tyAnn :: MonadParsec e PyTokens m => m (Colon, Expr SrcInfo) Source #

typedParams :: MonadParsec e PyTokens m => m (CommaSep (Param SrcInfo)) Source #

untypedParams :: MonadParsec e PyTokens m => m Whitespace -> m (CommaSep (Param SrcInfo)) Source #

upPositional :: MonadParsec e PyTokens m => m Whitespace -> m (Param SrcInfo) Source #

upStar :: MonadParsec e PyTokens m => m Whitespace -> m (Param SrcInfo) Source #

upDoubleStar :: MonadParsec e PyTokens m => m Whitespace -> m (Param SrcInfo) Source #

yieldExpr :: MonadParsec e PyTokens m => m Whitespace -> m (Expr SrcInfo) Source #

Formatting

anySpace :: MonadParsec e PyTokens m => m Whitespace Source #

space :: MonadParsec e PyTokens m => m Whitespace Source #

eol :: MonadParsec e PyTokens m => m Newline Source #

continued :: MonadParsec e PyTokens m => m Whitespace Source #

newline :: MonadParsec e PyTokens m => m Newline Source #

indent :: MonadParsec e PyTokens m => m (Indents SrcInfo) Source #

dedent :: MonadParsec e PyTokens m => m () Source #

level :: MonadParsec s PyTokens m => m (Indents SrcInfo) Source #

blank :: MonadParsec e PyTokens m => m (Blank SrcInfo) Source #

comment :: MonadParsec e PyTokens m => m (Comment SrcInfo) Source #

Miscellaneous combinators

sepBy1' :: MonadParsec e PyTokens m => m a -> m sep -> m (a, [(sep, a)], Maybe sep) Source #