Copyright | (C) CSIRO 2017-2019 |
---|---|
License | BSD3 |
Maintainer | Isaac Elliott <isaace71295@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- module Data.Validation
- module Language.Python.Parse.Error
- type Parser = Parsec Void PyTokens
- parseModule :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> Text -> Validation (NonEmpty e) (Module '[] SrcInfo)
- parseStatement :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> Text -> Validation (NonEmpty e) (Statement '[] SrcInfo)
- parseExpr :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> Text -> Validation (NonEmpty e) (Expr '[] SrcInfo)
- parseExprList :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> Text -> Validation (NonEmpty e) (Expr '[] SrcInfo)
- readModule :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> IO (Validation (NonEmpty e) (Module '[] SrcInfo))
- readStatement :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> IO (Validation (NonEmpty e) (Statement '[] SrcInfo))
- readExpr :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> IO (Validation (NonEmpty e) (Expr '[] SrcInfo))
- readExprList :: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) => FilePath -> IO (Validation (NonEmpty e) (Expr '[] SrcInfo))
- data SrcInfo = SrcInfo {
- _srcInfoName :: FilePath
- _srcInfoLineStart :: !Int
- _srcInfoLineEnd :: !Int
- _srcInfoColStart :: !Int
- _srcInfoColEnd :: !Int
- _srcInfoOffsetStart :: !Int
- _srcInfoOffsetEnd :: !Int
- initialSrcInfo :: FilePath -> SrcInfo
Documentation
module Data.Validation
module Language.Python.Parse.Error
Parsing some Text
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File name |
-> Text | Input to parse |
-> Validation (NonEmpty e) (Module '[] SrcInfo) |
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File name |
-> Text | Input to parse |
-> Validation (NonEmpty e) (Statement '[] SrcInfo) |
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File name |
-> Text | Input to parse |
-> Validation (NonEmpty e) (Expr '[] SrcInfo) |
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File name |
-> Text | Input to parse |
-> Validation (NonEmpty e) (Expr '[] SrcInfo) |
Parse an expression list (unparenthesised tuple)
https://docs.python.org/3.5/reference/expressions.html#grammar-token-expression_list
Parsing from a file
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File to read |
-> IO (Validation (NonEmpty e) (Module '[] SrcInfo)) |
Parse a module from a file
https://docs.python.org/3/reference/toplevel_components.html#file-input
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File to read |
-> IO (Validation (NonEmpty e) (Statement '[] SrcInfo)) |
Parse a statement from a file
https://docs.python.org/3/reference/compound_stmts.html#grammar-token-statement
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File to read |
-> IO (Validation (NonEmpty e) (Expr '[] SrcInfo)) |
Parse an expression from a file
https://docs.python.org/3.5/reference/expressions.html#grammar-token-expression
:: (AsLexicalError e Char, AsTabError e SrcInfo, AsIncorrectDedent e SrcInfo, AsParseError e (PyToken SrcInfo), AsIRError e SrcInfo) | |
=> FilePath | File to read |
-> IO (Validation (NonEmpty e) (Expr '[] SrcInfo)) |
Parse an expression list (unparenthesised tuple) from a file
https://docs.python.org/3.5/reference/expressions.html#grammar-token-expression_list
Source Information
SrcInfo | |
|
initialSrcInfo :: FilePath -> SrcInfo Source #