General tidying up

This commit is contained in:
JohnnyMorganz 2021-12-02 11:53:18 +00:00
parent de50a36404
commit 09694a8304

View file

@ -17,19 +17,20 @@ stat ::= varlist `=' explist |
for binding `=' exp `,' exp [`,' exp] do block end | for binding `=' exp `,' exp [`,' exp] do block end |
for bindinglist in explist do block end | for bindinglist in explist do block end |
function funcname funcbody | function funcname funcbody |
local function Name funcbody | local function NAME funcbody |
local bindinglist [`=' explist] | local bindinglist [`=' explist] |
[export] type Name [`<' GenericTypeList `>'] `=' TypeAnnotation [export] type NAME [`<' GenericTypeList `>'] `=' TypeAnnotation
laststat ::= return [explist] | break | continue laststat ::= return [explist] | break | continue
funcname ::= Name {`.' Name} [`:' Name] funcname ::= NAME {`.' NAME} [`:' NAME]
funcbody ::= `(' [parlist] `)' [`:' ReturnType] block end funcbody ::= `(' [parlist] `)' [`:' ReturnType] block end
parlist ::= bindinglist [`,' `...'] | `...' parlist ::= bindinglist [`,' `...'] | `...'
explist ::= {exp `,'} exp
namelist ::= Name {`,' Name}
binding ::= Name [`:' TypeAnnotation] explist ::= {exp `,'} exp
namelist ::= NAME {`,' NAME}
binding ::= NAME [`:' TypeAnnotation]
bindinglist ::= (binding | `...') [`,' bindinglist] bindinglist ::= (binding | `...') [`,' bindinglist]
subexpr ::= (asexp | unop subexpr) { binop subexpr } subexpr ::= (asexp | unop subexpr) { binop subexpr }
@ -37,21 +38,21 @@ ifelseexp ::= if exp then exp {elseif exp then exp} else exp
prefixexp ::= NAME | '(' expr ')' prefixexp ::= NAME | '(' expr ')'
primaryexp ::= prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } primaryexp ::= prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs }
asexp ::= simpleexp [`::' TypeAnnotation] asexp ::= simpleexp [`::' TypeAnnotation]
simpleexp ::= NUMBER | STRING | NIL | true | false | ... | constructor | FUNCTION body | primaryexp | ifelseexp simpleexp ::= NUMBER | STRING | nil | true | false | ... | tableconstructor | function body | primaryexp | ifelseexp
funcargs ::= `(' [explist] `)' | tableconstructor | String funcargs ::= `(' [explist] `)' | tableconstructor | STRING
tableconstructor ::= `{' [fieldlist] `}'
fieldlist ::= field {fieldsep field} [fieldsep]
field ::= `[' exp `]' `=' exp | NAME `=' exp | exp
fieldsep ::= `,' | `;'
compoundop :: `+=' | `-=' | `*=' | `/=' | `%=' | `^=' | `..=' compoundop :: `+=' | `-=' | `*=' | `/=' | `%=' | `^=' | `..='
binop ::= `+' | `-' | `*' | `/' | `^' | `%' | `..' | `<' | `<=' | `>' | `>=' | `==' | `~=' | and | or binop ::= `+' | `-' | `*' | `/' | `^' | `%' | `..' | `<' | `<=' | `>' | `>=' | `==' | `~=' | and | or
unop ::= `-' | not | `#´ unop ::= `-' | not | `#´
tableconstructor ::= `{' [fieldlist] `}'
fieldlist ::= field {fieldsep field} [fieldsep]
field ::= `[' exp `]' `=' exp | Name `=' exp | exp
fieldsep ::= `,' | `;'
SimpleTypeAnnotation ::= SimpleTypeAnnotation ::=
nil | nil |
Name[`.' Name] [ `<' TypeAnnotation [`,' ...] `>' ] | NAME[`.' NAME] [ `<' TypeAnnotation [`,' ...] `>' ] |
`typeof' `(' expr `)' | `typeof' `(' expr `)' |
`{' [PropList] `}' | `{' [PropList] `}' |
FunctionTypeAnnotation FunctionTypeAnnotation
@ -65,7 +66,7 @@ GenericTypeList ::= NAME [`...'] {`,' NAME}
TypeList ::= TypeAnnotation [`,' TypeList] | ...TypeAnnotation TypeList ::= TypeAnnotation [`,' TypeList] | ...TypeAnnotation
ReturnType ::= TypeAnnotation | `(' TypeList `)' ReturnType ::= TypeAnnotation | `(' TypeList `)'
TableIndexer ::= `[' TypeAnnotation `]' `:' TypeAnnotation TableIndexer ::= `[' TypeAnnotation `]' `:' TypeAnnotation
TableProp ::= Name `:' TypeAnnotation TableProp ::= NAME `:' TypeAnnotation
TablePropOrIndexer ::= TableProp | TableIndexer TablePropOrIndexer ::= TableProp | TableIndexer
PropList ::= TablePropOrIndexer {fieldsep TablePropOrIndexer} [fieldsep] PropList ::= TablePropOrIndexer {fieldsep TablePropOrIndexer} [fieldsep]
TableTypeAnnotation ::= `{' PropList `}' TableTypeAnnotation ::= `{' PropList `}'