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

Safe HaskellSafe-Inferred

Language.Lua.Syntax

Description

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

Synopsis

Documentation

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

;

data Exp Source

Constructors

Nil 
Bool Bool 
Number String 
String String 
Vararg

...

EFunDef FunBody

function (..) .. end

PrefixExp PrefixExp 
TableConst [TableField]

table constructor

Binop Binop Exp Exp

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

Unop Unop Exp

unary operators, - not #

data Var Source

Constructors

VarName Name

variable

Select PrefixExp Exp

table[exp]

SelectName PrefixExp Name

table.variable

data Binop Source

Constructors

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

data Unop Source

Constructors

Neg 
Not 
Len 

data Block Source

A block is list of statements with optional return statement.

Constructors

Block [Stat] (Maybe [Exp]) 

data FunBody Source

Constructors

FunBody [Name] Bool Block

(args, vararg, block)

data FunCall Source

Constructors

NormalFunCall PrefixExp FunArg

prefixexp ( funarg )

MethodCall PrefixExp Name FunArg

prefixexp : name ( funarg )

data FunArg Source

Constructors

Args [Exp]

list of args

TableArg [TableField]

table constructor

StringArg String

string