language-lua2-0.1.0.3: Lua parser and pretty printer

Safe HaskellNone
LanguageHaskell2010

Language.Lua.Syntax

Contents

Description

Abstract syntax of Lua 5.3 source files. See http://www.lua.org/manual/5.3/ for more information.

Synopsis

AST nodes

data Ident a Source

An identifier, defined as any string of letters, digits, or underscores, not beginning with a digit.

http://www.lua.org/manual/5.3/manual.html#3.1

Constructors

Ident !a !String 

Instances

Functor Ident 
Annotated Ident 
Eq a => Eq (Ident a) 
Data a => Data (Ident a) 
Show a => Show (Ident a) 
Generic (Ident a) 
Pretty (Ident a) 
Typeable (* -> *) Ident 
type Rep (Ident a) 

data IdentList a Source

Zero or more Idents.

Constructors

IdentList !a ![Ident a] 

Instances

data IdentList1 a Source

One or more Idents.

Constructors

IdentList1 !a !(NonEmpty (Ident a)) 

data Block a Source

A block of statements, possibly ending in a return statement.

http://www.lua.org/manual/5.3/manual.html#3.3.1

Constructors

Block !a ![Statement a] !(Maybe (ReturnStatement a)) 

Instances

Functor Block 
Annotated Block 
Eq a => Eq (Block a) 
Data a => Data (Block a) 
Show a => Show (Block a) 
Generic (Block a) 
Pretty (Block a) 
Typeable (* -> *) Block 
type Rep (Block a) 

data Statement a Source

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 Variable a Source

Constructors

VarIdent !a !(Ident a)
x
VarField !a !(PrefixExpression a) !(Expression a)
table[exp]
VarFieldName !a !(PrefixExpression a) !(Ident a)
table.field

Instances

data FunctionBody a Source

Constructors

FunctionBody !a !(IdentList a) !Bool !(Block a)
(x, y, ...) block end

data Field a Source

Constructors

FieldExp !a !(Expression a) !(Expression a)
[exp1] = exp2
FieldIdent !a !(Ident a) !(Expression a)
name = exp
Field !a !(Expression a)
exp

Instances

Functor Field 
Annotated Field 
Eq a => Eq (Field a) 
Data a => Data (Field a) 
Show a => Show (Field a) 
Generic (Field a) 
Pretty (Field a) 
Typeable (* -> *) Field 
type Rep (Field a) 

data FieldList a Source

Zero or more Fields, separated by , or ;.

Constructors

FieldList !a ![Field a] 

Instances

data Binop a Source

Constructors

Plus !a

+

Minus !a

-

Mult !a

*

FloatDiv !a

/

FloorDiv !a

//

Exponent !a

^

Modulo !a

%

BitwiseAnd !a

&

BitwiseXor !a

~

BitwiseOr !a

|

Rshift !a

>>

Lshift !a

<<

Concat !a

..

Lt !a

<

Leq !a

<=

Gt !a

>

Geq !a

>=

Eq !a

==

Neq !a

~=

And !a

and

Or !a

or

Instances

Functor Binop 
Annotated Binop 
Eq a => Eq (Binop a) 
Data a => Data (Binop a) 
Show a => Show (Binop a) 
Generic (Binop a) 
Pretty (Binop a) 
Typeable (* -> *) Binop 
type Rep (Binop a) 

data Unop a Source

Constructors

Negate !a

-

Not !a

not

Length !a

#

BitwiseNot !a

~

Instances

Functor Unop 
Annotated Unop 
Eq a => Eq (Unop a) 
Data a => Data (Unop a) 
Show a => Show (Unop a) 
Generic (Unop a) 
Pretty (Unop a) 
Typeable (* -> *) Unop 
type Rep (Unop a) 

Annotated typeclass