Skip to content

Commit

Permalink
Update grammar.md (#909)
Browse files Browse the repository at this point in the history
Fix issues mentioned in #908
  • Loading branch information
JohnnyMorganz authored Apr 24, 2023
1 parent fe7621e commit 8173491
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/_pages/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ parlist = bindinglist [',' '...'] | '...'
explist = {exp ','} exp
namelist = NAME {',' NAME}
binding = NAME [':' TypeAnnotation]
binding = NAME [':' Type]
bindinglist = binding [',' bindinglist] (* equivalent of Lua 5.1 'namelist', except with optional type annotations *)
var = NAME | prefixexp '[' exp ']' | prefixexp '.' Name
var = NAME | prefixexp '[' exp ']' | prefixexp '.' NAME
varlist = var {',' var}
prefixexp = var | functioncall | '(' exp ')'
functioncall = prefixexp funcargs | prefixexp ':' NAME funcargs
exp = (asexp | unop exp) { binop exp }
exp = asexp { binop exp } | unop exp { binop exp }
ifelseexp = 'if' exp 'then' exp {'elseif' exp 'then' exp} 'else' exp
asexp = simpleexp ['::' Type]
stringinterp = INTERP_BEGIN exp { INTERP_MID exp } INTERP_END
simpleexp = NUMBER | STRING | 'nil' | 'true' | 'false' | '...' | tableconstructor | 'function' body | prefixexp | ifelseexp | stringinterp
simpleexp = NUMBER | STRING | 'nil' | 'true' | 'false' | '...' | tableconstructor | 'function' funcbody | prefixexp | ifelseexp | stringinterp
funcargs = '(' [explist] ')' | tableconstructor | STRING
tableconstructor = '{' [fieldlist] '}'
Expand Down Expand Up @@ -85,5 +85,5 @@ TableProp = NAME ':' Type
TablePropOrIndexer = TableProp | TableIndexer
PropList = TablePropOrIndexer {fieldsep TablePropOrIndexer} [fieldsep]
TableType = '{' PropList '}'
FunctionType = ['<' GenericTypeList '>'] '(' [TypeList] ')' '->' ReturnType
FunctionType = ['<' GenericTypeParameterList '>'] '(' [TypeList] ')' '->' ReturnType
```

0 comments on commit 8173491

Please sign in to comment.