glualint-1.24.6: Attempts to fix your syntax erroring Lua files.
Safe HaskellSafe-Inferred
LanguageHaskell2010

GLua.PSParser

Synopsis

Documentation

execAParser :: SourceName -> AParser a -> [MToken] -> Either ParseError a Source #

Execute a parser

parseFromString :: AParser a -> String -> Either ParseError a Source #

Parse a string directly

parseGLua :: [MToken] -> Either ParseError AST Source #

Parse Garry's mod Lua tokens to an abstract syntax tree. Also returns parse errors

rgStart2sp :: Region -> SourcePos Source #

Region start to SourcePos

rgEnd2sp :: Region -> SourcePos Source #

Region end to SourcePos

sp2Rg :: SourcePos -> Region Source #

SourcePos to region

lcp2sp :: LineColPos -> SourcePos Source #

LineColPos to SourcePos

sp2lcp :: SourcePos -> LineColPos Source #

SourcePos to LineColPos

updatePosMToken :: SourcePos -> MToken -> [MToken] -> SourcePos Source #

Update a SourcePos with an MToken

pMTok :: Token -> AParser MToken Source #

Match a token

pMToken :: forall a. (MToken -> Maybe a) -> AParser a Source #

pPos :: AParser LineColPos Source #

Get the source position Simply gets the position of the next token Falls back on the collected position when there is no token left

pEndPos :: AParser LineColPos Source #

Get the source position Simply gets the end position of the last parsed token

annotated :: (Region -> a -> b) -> AParser a -> AParser b Source #

A thing of which the region is to be parsed

parseChunk :: [MToken] -> AParser AST Source #

Parses the full AST Its first parameter contains all comments Assumes the mtokens fed to the AParser have no comments

parseBlock :: AParser Block Source #

Parse a block with an optional return value

pInterleaved :: AParser a -> AParser b -> AParser [b] Source #

Parser that is interleaved with 0 or more of the other parser

parseReturn :: AParser AReturn Source #

Parse a return value

parseStat :: AParser Stat Source #

Parse a single statement

parseDefinition :: AParser Stat Source #

Global definition Note: Uses try to avoid conflicts with function calls

parseFunction :: AParser Stat Source #

Global function definition

parseLocalFunction :: AParser Stat Source #

Local function definition

parseIf :: AParser Stat Source #

Parse if then elseif then else end expressions

parseNFor :: AParser Stat Source #

Parse numeric for loop

parseGFor :: AParser Stat Source #

Generic for loop

parseFuncName :: AParser FuncName Source #

Function name (includes dot indices and meta indices)

parseLocFuncName :: AParser FuncName Source #

Local function name: cannot be a meta function nor indexed

parseNumber :: AParser Expr Source #

Parse a number into an expression

parseString :: AParser MToken Source #

Parse any kind of string

pName :: AParser MToken Source #

Parse an identifier

parseNameList :: AParser [MToken] Source #

Parse a list of identifiers

parseVarList :: AParser [PrefixExp] Source #

Parse variable list (var1, var2, var3)

parseLocalVarList :: AParser [PrefixExp] Source #

Parse local variable list (var1, var2, var3)

parseParList :: AParser [MToken] Source #

Parse list of function parameters

parseExpressionList :: AParser [MExpr] Source #

list of expressions

parseSubExpression :: AParser Expr Source #

Subexpressions, i.e. without operators

parseAnonymFunc :: AParser Expr Source #

Separate parser for anonymous function subexpression

samePrioL :: [(Token, BinOp)] -> AParser MExpr -> AParser MExpr Source #

Parse operators of the same precedence in a chain

parseUnOp :: AParser UnOp Source #

Parse unary operator (-, not, #)

parseBinOp :: AParser BinOp Source #

Parses a binary operator

lvl1 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

lvl2 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

lvl3 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

lvl4 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

lvl5 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

lvl6 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

lvl8 :: [(Token, BinOp)] Source #

Operators, sorted by priority Priority from: http://www.lua.org/manual/5.2/manual.html#3.4.7

parseExpression :: AParser MExpr Source #

Parse chains of binary and unary operators

parsePrefixExp :: AParser PrefixExp Source #

Prefix expressions can have any arbitrary list of expression suffixes

pPrefixExp :: AParser [PFExprSuffix] -> AParser PrefixExp Source #

Prefix expressions The suffixes define rules on the allowed suffixes

pPFExprSuffix :: AParser PFExprSuffix Source #

Parse any expression suffix

pPFExprCallSuffix :: AParser PFExprSuffix Source #

Parse an indexing expression suffix

pPFExprIndexSuffix :: AParser PFExprSuffix Source #

Parse an indexing expression suffix

pFunctionCall :: AParser PrefixExp Source #

Function calls are prefix expressions, but the last suffix MUST be either a function call or a metafunction call

parseVar :: AParser PrefixExp Source #

single variable. Note: definition differs from reference to circumvent the left recursion var ::= Name [{PFExprSuffix}* indexation] | '(' exp ')' {PFExprSuffix}* indexation where "{PFExprSuffix}* indexation" is any arbitrary sequence of prefix expression suffixes that end with an indexation

parseArgs :: AParser Args Source #

Arguments of a function call (including brackets)

parseFieldList :: AParser [Field] Source #

A list of table entries Grammar: field {separator field} [separator]

parseNamedField :: AParser (FieldSep -> Field) Source #

Parse a named field (e.g. {named = field}) Contains try to avoid conflict with unnamed fields

parseField :: AParser (FieldSep -> Field) Source #

A field in a table

parseFieldSep :: AParser FieldSep Source #

Field separator, either comma or semicolon

parseOptionalFieldSep :: AParser FieldSep Source #

Optional field separator, returns NoSep when no separator is found Used at the end of a field list