language-lua-0.1.7: Lua parser and pretty-printer

Safe HaskellSafe-Inferred

Language.Lua.Types

Description

Lua 5.2 syntax tree, as specified in http://www.lua.org/manual/5.2/manual.html#9.

Synopsis

Documentation

type Name = StringSource

data Stat Source

Constructors

Assign [Var] [Exp]

var1, var2 .. = exp1, exp2 ..

FunCall FunCall

function call

Label Name

label for goto

Break

break

Goto Name

goto label

Do Block

do .. end

While Exp Block

while .. do .. end

Repeat Block Exp

repeat .. until ..

If [(Exp, Block)] (Maybe Block)

if .. then .. [elseif ..] [else ..] end

ForRange Name Exp Exp (Maybe Exp) Block

for x=start, end [, step] do .. end

ForIn [Name] [Exp] Block

for x in .. do .. end

FunAssign FunName FunBody

function <var> (..) .. end

LocalFunAssign Name FunBody

local function <var> (..) .. end

LocalAssign [Name] (Maybe [Exp])

local var1, var2 .. = exp1, exp2 ..

EmptyStat

;

Instances

Eq Stat 
Show Stat 
LPretty Stat 

data Exp Source

Constructors

Nil 
Bool Bool 
Number String 
String String 
Vararg

...

EFunDef FunDef

function (..) .. end

PrefixExp PrefixExp 
TableConst Table

table constructor

Binop Binop Exp Exp

binary operators, + - * ^ % .. < <= > >= == ~= and or

Unop Unop Exp

unary operators, - not #

Instances

Eq Exp 
Show Exp 
LPretty Exp 

data Var Source

Constructors

Name Name

variable

Select PrefixExp Exp

table[exp]

SelectName PrefixExp Name

table.variable

Instances

Eq Var 
Show Var 
LPretty Var 

data Binop Source

Constructors

Add 
Sub 
Mul 
Div 
Exp 
Mod 
Concat 
LT 
LTE 
GT 
GTE 
EQ 
NEQ 
And 
Or 

Instances

Eq Binop 
Show Binop 
LPretty Binop 

data Unop Source

Constructors

Neg 
Not 
Len 

Instances

Eq Unop 
Show Unop 
LPretty Unop 

data Table Source

Constructors

Table [TableField]

list of table fields

Instances

Eq Table 
Show Table 
LPretty Table 

data TableField Source

Constructors

ExpField Exp Exp

[exp] = exp

NamedField Name Exp

name = exp

Field Exp 

data Block Source

A block is list of statements with optional return statement.

Constructors

Block [Stat] (Maybe [Exp]) 

Instances

Eq Block 
Show Block 
LPretty Block 

data FunName Source

Constructors

FunName Name (Maybe Name) [Name] 

Instances

data FunDef Source

Constructors

FunDef FunBody 

Instances

data FunBody Source

Constructors

FunBody [Name] Bool Block

(args, vararg predicate, block)

Instances

data FunCall Source

Constructors

NormalFunCall PrefixExp FunArg

prefixexp ( funarg )

MethodCall PrefixExp Name FunArg

prefixexp : name ( funarg )

Instances

data FunArg Source

Constructors

Args [Exp]

list of args

TableArg Table

table constructor

StringArg String

string

Instances