Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Lua.Syntax
Contents
Description
Abstract syntax of Lua 5.3 source files. See http://www.lua.org/manual/5.3/ for more information.
- data Ident a = Ident !a !String
- data IdentList a = IdentList !a ![Ident a]
- data IdentList1 a = IdentList1 !a !(NonEmpty (Ident a))
- type Chunk = Block
- data Block a = Block !a ![Statement a] !(Maybe (ReturnStatement a))
- data Statement a
- = EmptyStmt !a
- | Assign !a !(VariableList1 a) !(ExpressionList1 a)
- | FunCall !a !(FunctionCall a)
- | Label !a !(Ident a)
- | Break !a
- | Goto !a !(Ident a)
- | Do !a !(Block a)
- | While !a !(Expression a) !(Block a)
- | Repeat !a !(Block a) !(Expression a)
- | If !a !(NonEmpty (Expression a, Block a)) !(Maybe (Block a))
- | For !a !(Ident a) !(Expression a) !(Expression a) !(Maybe (Expression a)) !(Block a)
- | ForIn !a !(IdentList1 a) !(ExpressionList1 a) !(Block a)
- | FunAssign !a !(FunctionName a) !(FunctionBody a)
- | LocalFunAssign !a !(Ident a) !(FunctionBody a)
- | LocalAssign !a !(IdentList1 a) !(ExpressionList a)
- data ReturnStatement a = ReturnStatement !a !(ExpressionList a)
- data FunctionName a = FunctionName !a !(IdentList1 a) !(Maybe (Ident a))
- data Variable a
- = VarIdent !a !(Ident a)
- | VarField !a !(PrefixExpression a) !(Expression a)
- | VarFieldName !a !(PrefixExpression a) !(Ident a)
- data VariableList1 a = VariableList1 !a !(NonEmpty (Variable a))
- data Expression a
- = Nil !a
- | Bool !a !Bool
- | Integer !a !String
- | Float !a !String
- | String !a !String
- | Vararg !a
- | FunDef !a !(FunctionBody a)
- | PrefixExp !a !(PrefixExpression a)
- | TableCtor !a !(TableConstructor a)
- | Binop !a !(Binop a) !(Expression a) !(Expression a)
- | Unop !a !(Unop a) !(Expression a)
- data ExpressionList a = ExpressionList !a ![Expression a]
- data ExpressionList1 a = ExpressionList1 !a !(NonEmpty (Expression a))
- data PrefixExpression a
- = PrefixVar !a !(Variable a)
- | PrefixFunCall !a !(FunctionCall a)
- | Parens !a !(Expression a)
- data FunctionCall a
- = FunctionCall !a !(PrefixExpression a) !(FunctionArgs a)
- | MethodCall !a !(PrefixExpression a) !(Ident a) !(FunctionArgs a)
- data FunctionArgs a
- = Args !a !(ExpressionList a)
- | ArgsTable !a !(TableConstructor a)
- | ArgsString !a !String
- data FunctionBody a = FunctionBody !a !(IdentList a) !Bool !(Block a)
- data TableConstructor a = TableConstructor !a !(FieldList a)
- data Field a
- = FieldExp !a !(Expression a) !(Expression a)
- | FieldIdent !a !(Ident a) !(Expression a)
- | Field !a !(Expression a)
- data FieldList a = FieldList !a ![Field a]
- data Binop a
- data Unop a
- = Negate !a
- | Not !a
- | Length !a
- | BitwiseNot !a
- class Functor ast => Annotated ast where
AST nodes
An identifier, defined as any string of letters, digits, or underscores, not beginning with a digit.
Zero or more Ident
s.
data IdentList1 a Source
One or more Ident
s.
Constructors
IdentList1 !a !(NonEmpty (Ident a)) |
Instances
Functor IdentList1 Source | |
Annotated IdentList1 Source | |
Eq a => Eq (IdentList1 a) Source | |
Data a => Data (IdentList1 a) Source | |
Show a => Show (IdentList1 a) Source | |
Generic (IdentList1 a) Source | |
type Rep (IdentList1 a) Source |
A chunk; Lua's compilation unit.
A block of statements, possibly ending in a return statement.
Constructors
Block !a ![Statement a] !(Maybe (ReturnStatement a)) |
A statement.
Constructors
EmptyStmt !a | ; |
Assign !a !(VariableList1 a) !(ExpressionList1 a) | var1, var2, var3 = exp1, exp2, exp3 |
FunCall !a !(FunctionCall a) | foo.bar(args) |
Label !a !(Ident a) | ::label:: |
Break !a | break |
Goto !a !(Ident a) | goto label |
Do !a !(Block a) | do block end |
While !a !(Expression a) !(Block a) | while exp do block end |
Repeat !a !(Block a) !(Expression a) | repeat block until exp |
If !a !(NonEmpty (Expression a, Block a)) !(Maybe (Block a)) | if exp then block else block end |
For !a !(Ident a) !(Expression a) !(Expression a) !(Maybe (Expression a)) !(Block a) | for x = exp do block end |
ForIn !a !(IdentList1 a) !(ExpressionList1 a) !(Block a) | for a, b, c in exp1, exp2, exp3 do block end |
FunAssign !a !(FunctionName a) !(FunctionBody a) | function name body |
LocalFunAssign !a !(Ident a) !(FunctionBody a) | local function name body |
LocalAssign !a !(IdentList1 a) !(ExpressionList a) | local x, y, z |
data ReturnStatement a Source
Constructors
ReturnStatement !a !(ExpressionList a) | return exp1, exp2 |
Instances
Functor ReturnStatement Source | |
Annotated ReturnStatement Source | |
Eq a => Eq (ReturnStatement a) Source | |
Data a => Data (ReturnStatement a) Source | |
Show a => Show (ReturnStatement a) Source | |
Generic (ReturnStatement a) Source | |
Pretty (ReturnStatement a) Source | |
type Rep (ReturnStatement a) Source |
data FunctionName a Source
Constructors
FunctionName !a !(IdentList1 a) !(Maybe (Ident a)) | foo.bar:baz |
Instances
Functor FunctionName Source | |
Annotated FunctionName Source | |
Eq a => Eq (FunctionName a) Source | |
Data a => Data (FunctionName a) Source | |
Show a => Show (FunctionName a) Source | |
Generic (FunctionName a) Source | |
Pretty (FunctionName a) Source | |
type Rep (FunctionName a) Source |
Constructors
VarIdent !a !(Ident a) | x |
VarField !a !(PrefixExpression a) !(Expression a) | table[exp] |
VarFieldName !a !(PrefixExpression a) !(Ident a) | table.field |
data VariableList1 a Source
One or more Variable
s.
Constructors
VariableList1 !a !(NonEmpty (Variable a)) |
Instances
Functor VariableList1 Source | |
Annotated VariableList1 Source | |
Eq a => Eq (VariableList1 a) Source | |
Data a => Data (VariableList1 a) Source | |
Show a => Show (VariableList1 a) Source | |
Generic (VariableList1 a) Source | |
type Rep (VariableList1 a) Source |
data Expression a Source
An expression.
Constructors
Nil !a | |
Bool !a !Bool | |
Integer !a !String | |
Float !a !String | |
String !a !String | |
Vararg !a | |
FunDef !a !(FunctionBody a) | |
PrefixExp !a !(PrefixExpression a) | |
TableCtor !a !(TableConstructor a) | |
Binop !a !(Binop a) !(Expression a) !(Expression a) | |
Unop !a !(Unop a) !(Expression a) |
Instances
Functor Expression Source | |
Annotated Expression Source | |
Eq a => Eq (Expression a) Source | |
Data a => Data (Expression a) Source | |
Show a => Show (Expression a) Source | |
Generic (Expression a) Source | |
Pretty (Expression a) Source | |
type Rep (Expression a) Source |
data ExpressionList a Source
Zero or more Expression
s.
Constructors
ExpressionList !a ![Expression a] |
Instances
Functor ExpressionList Source | |
Annotated ExpressionList Source | |
Eq a => Eq (ExpressionList a) Source | |
Data a => Data (ExpressionList a) Source | |
Show a => Show (ExpressionList a) Source | |
Generic (ExpressionList a) Source | |
type Rep (ExpressionList a) Source |
data ExpressionList1 a Source
One or more Expression
s.
Constructors
ExpressionList1 !a !(NonEmpty (Expression a)) |
Instances
Functor ExpressionList1 Source | |
Annotated ExpressionList1 Source | |
Eq a => Eq (ExpressionList1 a) Source | |
Data a => Data (ExpressionList1 a) Source | |
Show a => Show (ExpressionList1 a) Source | |
Generic (ExpressionList1 a) Source | |
type Rep (ExpressionList1 a) Source |
data PrefixExpression a Source
Constructors
PrefixVar !a !(Variable a) | |
PrefixFunCall !a !(FunctionCall a) | |
Parens !a !(Expression a) |
Instances
Functor PrefixExpression Source | |
Annotated PrefixExpression Source | |
Eq a => Eq (PrefixExpression a) Source | |
Data a => Data (PrefixExpression a) Source | |
Show a => Show (PrefixExpression a) Source | |
Generic (PrefixExpression a) Source | |
Pretty (PrefixExpression a) Source | |
type Rep (PrefixExpression a) Source |
data FunctionCall a Source
A function call. May be a statement or an expression.
Constructors
FunctionCall !a !(PrefixExpression a) !(FunctionArgs a) | |
MethodCall !a !(PrefixExpression a) !(Ident a) !(FunctionArgs a) |
Instances
Functor FunctionCall Source | |
Annotated FunctionCall Source | |
Eq a => Eq (FunctionCall a) Source | |
Data a => Data (FunctionCall a) Source | |
Show a => Show (FunctionCall a) Source | |
Generic (FunctionCall a) Source | |
Pretty (FunctionCall a) Source | |
type Rep (FunctionCall a) Source |
data FunctionArgs a Source
Constructors
Args !a !(ExpressionList a) | (exp1, exp2) |
ArgsTable !a !(TableConstructor a) | { x = exp } |
ArgsString !a !String | "str" |
Instances
Functor FunctionArgs Source | |
Annotated FunctionArgs Source | |
Eq a => Eq (FunctionArgs a) Source | |
Data a => Data (FunctionArgs a) Source | |
Show a => Show (FunctionArgs a) Source | |
Generic (FunctionArgs a) Source | |
Pretty (FunctionArgs a) Source | |
type Rep (FunctionArgs a) Source |
data FunctionBody a Source
Constructors
FunctionBody !a !(IdentList a) !Bool !(Block a) | (x, y, ...) block end |
Instances
Functor FunctionBody Source | |
Annotated FunctionBody Source | |
Eq a => Eq (FunctionBody a) Source | |
Data a => Data (FunctionBody a) Source | |
Show a => Show (FunctionBody a) Source | |
Generic (FunctionBody a) Source | |
Pretty (FunctionBody a) Source | |
type Rep (FunctionBody a) Source |
data TableConstructor a Source
A table constructor.
Constructors
TableConstructor !a !(FieldList a) | { x = 5, [f(1)] = 6, 7 } |
Instances
Functor TableConstructor Source | |
Annotated TableConstructor Source | |
Eq a => Eq (TableConstructor a) Source | |
Data a => Data (TableConstructor a) Source | |
Show a => Show (TableConstructor a) Source | |
Generic (TableConstructor a) Source | |
Pretty (TableConstructor a) Source | |
type Rep (TableConstructor a) Source |
Constructors
FieldExp !a !(Expression a) !(Expression a) | [exp1] = exp2 |
FieldIdent !a !(Ident a) !(Expression a) | name = exp |
Field !a !(Expression a) | exp |
Zero or more Field
s, separated by ,
or ;
.
Constructors
Negate !a | - |
Not !a | not |
Length !a | # |
BitwiseNot !a | ~ |
Annotated typeclass
class Functor ast => Annotated ast where Source
Instances