script

statstat

stat

assignment_statassignment_stat do_statdo_stat while_statwhile_stat repeat_statrepeat_stat for_loop_statfor_loop_stat for_seq_statfor_seq_stat func_call_statfunc_call_stat if_statif_stat function_deffunction_def

assignment_stat

LOCALLOCAL varlist1varlist1 EQEQ explist1explist1

varlist1

varvar ',' [suppress] varvar

var

var_partvar_part '.' [suppress] var_partvar_part

var_part

var_atomvar_atom index_refindex_ref functioncallfunctioncall namename exp_groupexp_group

var_atom

functioncallfunctioncall namename exp_groupexp_group

functioncall

prefixexpprefixexp COLONCOLON namename argsargs

prefixexp

namename exp_groupexp_group

name

keywordkeyword [NOT] identifieridentifier '.' keywordkeyword [NOT] identifieridentifier [combine]

keyword

'return' 'break' 'do' 'end' 'while' 'if' 'then' 'elseif' 'else' 'for' 'in' 'function' 'local' 'repeat' 'until' 'nil' 'false' 'true' 'and' 'or' 'not'

identifier

W:(A-Z_a-zªµºÀ-Ö..., 0-9A-Z_a-zªµ·...)

exp_group

LPARLPAR expexp RPARRPAR

exp

'or' operations'or' operations

'or' operations

'and' operations'and' operations OROR 'and' operations'and' operations 'and' operations'and' operations

'and' operations

<= | < | >= | > | ~= | == operations<= | < | >= | > | ~= | == operations ANDAND <= | < | >= | > | ~= | == operations<= | < | >= | > | ~= | == operations <= | < | >= | > | ~= | == operations<= | < | >= | > | ~= | == operations

<= | < | >= | > | ~= | == operations

'|' operations'|' operations <= | < | >= | > | ~= | ==<= | < | >= | > | ~= | == '|' operations'|' operations '|' operations'|' operations

'|' operations

'~' operations'~' operations '|' '~' operations'~' operations '~' operations'~' operations

'~' operations

'&' operations'&' operations '~' '&' operations'&' operations '&' operations'&' operations

'&' operations

<< | >> operations<< | >> operations '&' << | >> operations<< | >> operations << | >> operations<< | >> operations

<< | >> operations

'..' operations'..' operations << | >><< | >> '..' operations'..' operations '..' operations'..' operations

'..' operations

+ | - operations+ | - operations '..' + | - operations+ | - operations + | - operations+ | - operations

+ | - operations

* | // | / | % operations* | // | / | % operations + | -+ | - * | // | / | % operations* | // | / | % operations * | // | / | % operations* | // | / | % operations

* | // | / | % operations

not op operationsnot op operations * | // | / | %* | // | / | % not op operationsnot op operations not op operationsnot op operations

not op operations

not opnot op not op operationsnot op operations '^' operations'^' operations

not op

NOTNOT # | - | ~# | - | ~

NOT

'not'

# | - | ~

[#\-~]

'^' operations

NILNIL FALSEFALSE TRUETRUE real number with scientific notationreal number with scientific notation real numberreal number signed integersigned integer string enclosed in "'" string enclosed in '"' multiline_stringmultiline_string ELLIPSISELLIPSIS functioncallfunctioncall varvar tableconstructortableconstructor nested_exp_atomnested_exp_atom '^' NILNIL FALSEFALSE TRUETRUE real number with scientific notationreal number with scientific notation real numberreal number signed integersigned integer string enclosed in "'" string enclosed in '"' multiline_stringmultiline_string ELLIPSISELLIPSIS functioncallfunctioncall varvar tableconstructortableconstructor nested_exp_atomnested_exp_atom NILNIL FALSEFALSE TRUETRUE real number with scientific notationreal number with scientific notation real numberreal number signed integersigned integer string enclosed in "'" string enclosed in '"' multiline_stringmultiline_string ELLIPSISELLIPSIS functioncallfunctioncall varvar tableconstructortableconstructor nested_exp_atomnested_exp_atom

tableconstructor

LBRACELBRACE field_listfield_list RBRACERBRACE

LBRACE

'{' [suppress]

field_list

fieldfield fieldsepfieldsep [suppress] fieldfield fieldsepfieldsep [suppress]

field

LBRACKLBRACK expexp RBRACKRBRACK EQEQ expexp namename EQEQ expexp expexp

fieldsep

COMMACOMMA SEMISEMI

RBRACE

'}' [suppress]

nested_exp_atom

'(' [suppress] expexp ')' [suppress]

NIL

'nil'

FALSE

'false'

TRUE

'true'

real number with scientific notation

[+-]?(?:\d+(?:[eE][+-]?\d+)|(?:\d+\.\d*|\.\d+)(?:[eE][+-]?\d+)?)

real number

[+-]?(?:\d+\.\d*|\.\d+)

signed integer

[+-]?\d+

* | // | / | %

\*|//|/|%

+ | -

[+\-]

<< | >>

<<|>>

<= | < | >= | > | ~= | ==

<=|<|>=|>|\~=|==

AND

'and'

OR

'or'

args

LPARLPAR explist1explist1 RPARRPAR tableconstructortableconstructor string enclosed in "'" string enclosed in '"' multiline_stringmultiline_string

explist1

expexp ',' [suppress] expexp

multiline_string

quoted string, starting with [[ ending with ]]

index_ref

LBRACKLBRACK expexp RBRACKRBRACK

LBRACK

'[' [suppress]

RBRACK

']' [suppress]

do_stat

DODO blockblock ENDEND

block

statstat OPT_SEMIOPT_SEMI laststatlaststat OPT_SEMIOPT_SEMI

OPT_SEMI

SEMISEMI [suppress]

SEMI

';' [suppress]

laststat

RETURNRETURN explist1explist1 BREAKBREAK

RETURN

'return'

BREAK

'break'

while_stat

WHILEWHILE expexp blockblock ENDEND

WHILE

'while'

repeat_stat

REPEATREPEAT blockblock UNTILUNTIL expexp

REPEAT

'repeat'

UNTIL

'until'

for_loop_stat

FORFOR namename EQEQ expexp COMMACOMMA expexp COMMACOMMA expexp DODO blockblock ENDEND

EQ

'='

for_seq_stat

FORFOR namelistnamelist ININ explist1explist1 DODO blockblock ENDEND

FOR

'for'

namelist

namename ',' [suppress] namename

IN

'in'

DO

'do'

func_call_stat

LOCALLOCAL functioncallfunctioncall

if_stat

IFIF expexp THENTHEN blockblock ELSEIFELSEIF expexp THENTHEN blockblock ELSEELSE blockblock ENDEND

IF

'if'

ELSEIF

'elseif'

THEN

'then'

ELSE

'else'

function_def

LOCALLOCAL FUNCTIONFUNCTION funcnamefuncname LPARLPAR parlistparlist RPARRPAR blockblock ENDEND

LOCAL

'local'

FUNCTION

'function'

funcname

namename COLONCOLON namename namename

COLON

':' [suppress]

LPAR

'(' [suppress]

parlist

namelistnamelist COMMACOMMA ELLIPSISELLIPSIS ELLIPSISELLIPSIS

COMMA

',' [suppress]

ELLIPSIS

'...'

RPAR

')' [suppress]

END

'end'