mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add type pack argument grammar
Including variadic/generic type packs
This commit is contained in:
parent
e0b9aadb06
commit
39f85e2c9c
1 changed files with 4 additions and 4 deletions
|
@ -7,8 +7,6 @@ classes: wide
|
|||
This is the complete syntax grammar for Luau in EBNF. More information about the terminal nodes String and Number
|
||||
is available in the [syntax section](syntax).
|
||||
|
||||
> Note: this grammar is currently missing type pack syntax for generic arguments
|
||||
|
||||
```ebnf
|
||||
chunk = block
|
||||
block = {stat [';']} [laststat [';']]
|
||||
|
@ -63,7 +61,7 @@ SimpleType =
|
|||
STRING |
|
||||
'true' |
|
||||
'false' |
|
||||
NAME ['.' NAME] [ '<' TypeList '>' ] |
|
||||
NAME ['.' NAME] [ '<' [TypeParams] '>' ] |
|
||||
'typeof' '(' exp ')' |
|
||||
TableType |
|
||||
FunctionType
|
||||
|
@ -76,7 +74,9 @@ Type =
|
|||
GenericTypePack = NAME '...' ['=' '(' TypeList ')']
|
||||
GenericTypeList = NAME ['=' Type] [',' GenericTypeList] | GenericTypePack {',' GenericTypePack}
|
||||
TypeList = Type [',' TypeList] | '...' Type
|
||||
ReturnType = Type | '(' TypeList ')'
|
||||
TypeParams = (Type | TypePack | '...' Type | NAME '...') [',' TypeParams]
|
||||
TypePack = '(' [TypeList] ')'
|
||||
ReturnType = Type | TypePack
|
||||
TableIndexer = '[' Type ']' ':' Type
|
||||
TableProp = NAME ':' Type
|
||||
TablePropOrIndexer = TableProp | TableIndexer
|
||||
|
|
Loading…
Add table
Reference in a new issue