-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | javascript parser for es6 and es7.
--
-- Please see the README on Github at
-- https://github.com/diasbruno/language-js#README.md
@package language-js
@version 0.2.0
module Language.JS.Common
parens :: Stream s m Char => ParsecT s u m a -> ParsecT s u m a
braces :: Stream s m Char => ParsecT s u m a -> ParsecT s u m a
angles :: Stream s m Char => ParsecT s u m a -> ParsecT s u m a
brackets :: Stream s m Char => ParsecT s u m a -> ParsecT s u m a
semi :: Stream s m Char => ParsecT s u m String
comma :: Stream s m Char => ParsecT s u m String
dot :: Stream s m Char => ParsecT s u m String
colon :: Stream s m Char => ParsecT s u m String
dotSep :: Stream s m Char => ParsecT s u m a -> ParsecT s u m [a]
commaSep :: Stream s m Char => ParsecT s u m a -> ParsecT s u m [a]
semiSep :: Stream s m Char => ParsecT s u m a -> ParsecT s u m [a]
commaSep1 :: Stream s m Char => ParsecT s u m a -> ParsecT s u m [a]
semiSep1 :: Stream s m Char => ParsecT s u m a -> ParsecT s u m [a]
whiteSpace :: Stream s m Char => ParsecT s u m Char
whiteSpaces :: Stream s m Char => ParsecT s u m String
betweenSpaces :: Stream s m Char => ParsecT s u m a -> ParsecT s u m a
lexeme :: Stream s m Char => ParsecT s u m a -> ParsecT s u m a
keywordB :: Stream s m Char => String -> ParsecT s u m String
-- | reserved words
reservedWords :: [String]
module Language.JS.Types
data ObjectProperty
OPI :: Expression -> ObjectProperty
OPKV :: Expression -> Expression -> ObjectProperty
OP :: Expression -> ObjectProperty
OPM :: Expression -> ObjectProperty
type IsPrefix = Bool
data SwitchCase
Case :: Expression -> SwitchCase
DefaultCase :: SwitchCase
type ExpressionOpt = Maybe Expression
type StatementOpt = Maybe Statement
data ForStyle
ForIn :: BindExpression -> Expression -> ForStyle
ForInV :: String -> BindExpression -> Expression -> ForStyle
ForOf :: BindExpression -> Expression -> ForStyle
ForOfV :: String -> BindExpression -> Expression -> ForStyle
ForRegular :: (Maybe BindExpression) -> ExpressionOpt -> ExpressionOpt -> ForStyle
-- | import and export binds * as identifier A, ... {x,...}
data ImportClause
Namespace :: Expression -> ImportClause
DefaultName :: Expression -> ImportClause
BindNames :: [Expression] -> ImportClause
data BindExpression
BindVar :: Expression -> (Maybe Expression) -> BindExpression
BindPattern :: Expression -> (Maybe Expression) -> BindExpression
BindRest :: Expression -> BindExpression
data TemplateString
TString :: String -> TemplateString
TExpression :: Expression -> TemplateString
data Expression
LThis :: Expression
LNull :: Expression
LI :: String -> Expression
LN :: String -> Expression
LS :: String -> Expression
LTS :: [TemplateString] -> Expression
LB :: Bool -> Expression
RegExp :: String -> String -> Expression
UnaryUpdate :: String -> IsPrefix -> Expression -> Expression
Unary :: String -> Expression -> Expression
Spread :: Expression -> Expression
Elision :: Expression
LA :: [Expression] -> Expression
LO :: [ObjectProperty] -> Expression
LP :: Expression -> Expression
Condition :: Expression -> Expression -> Expression -> Expression
Assignment :: String -> Expression -> Expression -> Expression
Operation :: String -> Expression -> Expression -> Expression
Function :: ExpressionOpt -> [BindExpression] -> Statement -> Expression
Arrow :: (Either BindExpression [BindExpression]) -> Statement -> Expression
Class :: ExpressionOpt -> ExpressionOpt -> Statement -> Expression
ClassProperty :: Expression -> Expression -> Expression
PropertyMethod :: Expression -> [BindExpression] -> Statement -> Expression
ClassStatic :: Expression -> Expression
ClassGetMethod :: Expression -> Expression
ClassSetMethod :: Expression -> Expression
Async :: Expression -> Expression
Dot :: Expression -> Expression -> Expression
Acc :: Expression -> Expression -> Expression
FCall :: Expression -> [Expression] -> Expression
New :: Expression -> Expression
Comma :: Expression -> Expression -> Expression
Empty :: Expression
Comment :: String -> Expression
MultilineComment :: String -> Expression
data Statement
SExp :: Expression -> Statement
SImportFile :: Expression -> Statement
SImport :: (Either ImportClause [ImportClause]) -> Expression -> Statement
SRExport :: Expression -> Expression -> Statement
SExport :: Statement -> Statement
SExportDefault :: Expression -> Statement
SC :: String -> ExpressionOpt -> Statement -> Statement
SF :: String -> [BindExpression] -> Statement -> Statement
SVariable :: String -> [BindExpression] -> Statement
SWhile :: [Expression] -> Statement -> Statement
SDoWhile :: Statement -> [Expression] -> Statement
SFor :: ForStyle -> Statement -> Statement
SLabel :: Expression -> Statement -> Statement
SDebugger :: Statement
SContinue :: ExpressionOpt -> Statement
SBreak :: ExpressionOpt -> Statement
SBlock :: [Statement] -> Statement
SIf :: Expression -> Statement -> StatementOpt -> Statement
SSwitch :: Expression -> [Statement] -> Statement
SCase :: [SwitchCase] -> [Statement] -> Statement
SThrow :: Expression -> Statement
STry :: Statement -> Statement -> StatementOpt -> Statement
SCatch :: ExpressionOpt -> Statement -> Statement
SFinally :: Statement -> Statement
SReturn :: Expression -> Statement
SWith :: Expression -> Statement -> Statement
instance GHC.Show.Show Language.JS.Types.SwitchCase
instance GHC.Show.Show Language.JS.Types.ForStyle
instance GHC.Show.Show Language.JS.Types.ImportClause
instance GHC.Show.Show Language.JS.Types.ObjectProperty
instance GHC.Show.Show Language.JS.Types.BindExpression
instance GHC.Show.Show Language.JS.Types.TemplateString
instance GHC.Show.Show Language.JS.Types.Expression
instance GHC.Show.Show Language.JS.Types.Statement
module Language.JS.Operators
opNotFollowedBy :: (Show a, Stream s m Char) => String -> ParsecT s u m a -> ParsecT s u m String
table :: Stream s m Char => Bool -> ParsecT s u m Expression -> [[Operator s u m Expression]]
operationExpression :: Stream s m Char => Bool -> ParsecT s u m Expression -> ParsecT s u m Expression -> ParsecT s u m Expression
module Language.JS.Parser
-- | Identifier name.
identifierName :: () => ParsecT String u Identity [Char]
-- | Parse identifier (no reserved words).
identifier :: () => ParsecT String u Identity Expression
-- | Parse numeric literal. Here we don't distinguish between kinds.
numericLiteral :: () => ParsecT String u Identity Expression
-- | Parse boolean literal.
booleanLiteral :: () => ParsecT String u Identity Expression
-- | this identifier
thisIdent :: () => ParsecT String u Identity Expression
-- | null identifier
nullIdent :: () => ParsecT String u Identity Expression
-- | Parse string literal.
stringLiteral :: () => ParsecT String u Identity Expression
-- | Parse template strings.
templateString :: () => [Char] -> [TemplateString] -> ParsecT String u Identity [TemplateString]
-- | Parse regular expression literal.
regexLiteral :: () => ParsecT String u Identity Expression
-- | Parse elision (aka ',' without a value on array).
elision :: () => ParsecT String u Identity Expression
-- | Parse many items on a array declaration.
arrayItems :: () => [Expression] -> ParsecT String u Identity [Expression]
-- | Parse array literal.
arrayLiteral :: () => ParsecT String u Identity Expression
-- | key and/or value property pair.
objectBinds :: () => ParsecT String u Identity ObjectProperty
-- | Parse object literal. objectLiteral :: P.ParsecT s u m Expression
objectLiteral :: () => ParsecT String u Identity Expression
-- | Parse parenthesis expression.
parensExpression :: () => ParsecT String u Identity Expression
-- | Check for spread operation before parse p.
checkSpread :: Stream s m Char => (b -> b) -> ParsecT s u m b -> ParsecT s u m b
-- | Parse used by function declarations.
formalParameter :: () => ParsecT String u Identity BindExpression
-- | Parse function declaration
functionDeclaration :: () => ParsecT String u Identity Expression
-- | Prase arrow function declaration.
arrowFunctionDeclaration :: () => ParsecT String u Identity Expression
-- | Parse any kind of funcion declaration (function or arrow function).
functionExpression :: () => ParsecT String u Identity Expression
-- | Parse property method of a class or object literal.
propertyMethodDef :: () => ParsecT String u Identity Expression
-- | Parse a static property of a class.
classStaticDef :: () => ParsecT String u Identity Expression
-- | Parse a getter or setter method.
classGetSetMethodDef :: () => ParsecT String u Identity Expression
-- | Check for a async property method.
asyncMethodDef :: () => ParsecT String u Identity Expression
-- | Parse a class property definition.
classPropertyDef :: () => ParsecT String u Identity Expression
-- | Parse a class declaration.
classDeclaration :: () => ParsecT String u Identity Expression
-- | Dot member.
dotMember :: () => Expression -> ParsecT String u Identity Expression
-- | Array like accessor.
accessor :: () => Expression -> ParsecT String u Identity Expression
-- | Function call.
functionCall :: () => Expression -> ParsecT String u Identity Expression
-- | new
newIdent :: () => ParsecT String u Identity Maybe a
-- | Parse member expression.
memberExpression :: () => Maybe Expression -> ParsecT String u Identity Expression
-- | Parse literals.
literals :: () => ParsecT String u Identity Expression
-- | Parse primary expressions.
primaryExpression :: () => ParsecT String u Identity Expression
-- | Check for maybe semi. TODO: There are some rules for expression
-- termination...need to check that.
maybeSemi :: () => ParsecT String u Identity ()
-- | Parse a empty expression.
emptyExpression :: () => ParsecT String u Identity Expression
-- | Parse rules for left hand side expression.
leftHandSideExpression :: () => ParsecT String u Identity Expression
-- | Parse expressions.
expressions :: () => ParsecT String u Identity Expression
-- | Parse single line comment.
comment :: () => ParsecT String u Identity Expression
-- | Parse multiline comment.
multilineComment :: () => ParsecT String u Identity Expression
-- | Parse comment like an expression.
commentExpression :: () => ParsecT String u Identity Expression
-- | Parse expressions excluding emptyExpression.
expressionNonEmpty :: () => Bool -> ParsecT String u Identity Expression
-- | Convert a expression into a statement.
toStatement :: Expression -> Statement
-- | Parse import namespace clauses.
importNamespaceClause :: () => ParsecT String u Identity ImportClause
-- | Parse import bind clauses.
importBindClause :: () => ParsecT String u Identity ImportClause
-- | Parse default clauses.
importDefaultNameClause :: () => ParsecT String u Identity ImportClause
-- | Parse import clauses excluding namespace clause.
importManyClauses :: () => ParsecT String u Identity [ImportClause]
-- | Parse all import clauses.
importClauses :: () => ParsecT String u Identity Either ImportClause [ImportClause]
-- | Parse import file statement.
importFileStatement :: () => ParsecT String u Identity Statement
-- | Parse import statement.
importStatement :: () => ParsecT String u Identity Statement
-- | Parse import statements.
importStatements :: () => ParsecT String u Identity Statement
reexportStatement :: () => ParsecT String u Identity Statement
exportDefaultStatement :: () => ParsecT String u Identity Statement
exportStatement :: () => ParsecT String u Identity Statement
-- | Parse export statements.
exportStatements :: () => ParsecT String u Identity Statement
-- | Parse continue statement.
continueStatement :: () => ParsecT String u Identity Statement
-- | Parse break statement.
breakStatement :: () => ParsecT String u Identity Statement
-- | Parse block statement.
blockStatement :: Stream s m Char => ParsecT s u m Statement -> ParsecT s u m Statement
blockOrStatements :: () => ParsecT String u Identity Statement
-- | Parse if statement.
ifStatement :: () => ParsecT String u Identity Statement
-- | Parse catch part of try statement.
catchBlock :: () => ParsecT String u Identity Statement
-- | Parse finally part of try statement.
finallyBlock :: () => ParsecT String u Identity Statement
-- | Parse try statement.
tryStatement :: () => ParsecT String u Identity Statement
-- | Parse throw statement.
throwStatement :: () => ParsecT String u Identity Statement
-- | Parse return statement.
returnStatement :: () => ParsecT String u Identity Statement
bindVar :: () => ParsecT String u Identity BindExpression
bindPatternDecl :: () => ParsecT String u Identity BindExpression
bindSpread :: () => ParsecT String u Identity BindExpression
bindExpression :: () => ParsecT String u Identity BindExpression
constVariableStatement :: () => ParsecT String u Identity Statement
notConstVariableStatement :: () => ParsecT String u Identity Statement
-- | Parse variable statement.
variableStatement :: () => ParsecT String u Identity Statement
-- | Parse case clause switch statement.
caseClause :: () => ParsecT String u Identity SwitchCase
-- | Parse case clause switch statement.
caseDeclaration :: () => ParsecT String u Identity Statement
-- | Parse switch statement.
switchStatement :: () => ParsecT String u Identity Statement
-- | Parse debugger statement.
debuggerStatement :: () => ParsecT String u Identity Statement
-- | Parse breakable statement. TODO: this parser can be improved to parse
-- vaild javascript code by passing to the break statement to subsequent
-- statements.
breakableStatement :: () => ParsecT String u Identity Statement
-- | Parse while statement.
whileStatement :: () => ParsecT String u Identity Statement
-- | parse do-while statement.
doWhileStatement :: () => ParsecT String u Identity Statement
forInVStyle :: () => ParsecT String u Identity ForStyle
forOfVStyle :: () => ParsecT String u Identity ForStyle
forInStyle :: () => ParsecT String u Identity ForStyle
forOfStyle :: () => ParsecT String u Identity ForStyle
forRegularStyle :: () => ParsecT String u Identity ForStyle
forStyle :: () => ParsecT String u Identity ForStyle
-- | Parse for statement.
forStatement :: () => ParsecT String u Identity Statement
-- | Parse iteration statements (for, white, do/while).
iterationStatement :: () => ParsecT String u Identity Statement
-- | Parse with statement.
withStatement :: () => ParsecT String u Identity Statement
-- | Parse labelled statement.
labelledStatement :: () => ParsecT String u Identity Statement
-- | Parse statements.
statements :: () => ParsecT String u Identity Statement
-- | Parse all statements allowed to be on top level. This helps to not
-- allow import and export expressions in any other part of the code.
topLevelStatements :: () => ParsecT String u Identity Statement
-- | parser
parseJs :: () => ParsecT String u Identity [Statement]
-- | Parse a script with a filename.
parse :: SourceName -> String -> Either ParseError [Statement]
-- | Parse a script from a file. Just for convinience.
parseFromFile :: SourceName -> IO Either ParseError [Statement]