Small fixes

This commit is contained in:
JohnnyMorganz 2021-12-02 14:47:23 +00:00
parent b6d4ac54dc
commit af25b8dc8f

View file

@ -4,7 +4,7 @@ title: Grammar
toc: true toc: true
--- ---
This is the complete syntax grammar for Luau in EBNF. More information about the terminal nodes Name, String and Number 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). is available in the [syntax section](syntax).
``` ```
@ -36,9 +36,9 @@ namelist ::= NAME {`,' NAME}
binding ::= NAME [`:' TypeAnnotation] binding ::= NAME [`:' TypeAnnotation]
bindinglist ::= (binding | `...') [`,' bindinglist] bindinglist ::= (binding | `...') [`,' bindinglist]
subexpr ::= (asexp | unop subexpr) { binop subexpr } exp ::= (asexp | unop exp) { binop exp }
ifelseexp ::= if exp then exp {elseif exp then exp} else exp ifelseexp ::= if exp then exp {elseif exp then exp} else exp
prefixexp ::= NAME | '(' expr ')' prefixexp ::= NAME | '(' exp ')'
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 | ... | tableconstructor | function body | primaryexp | ifelseexp simpleexp ::= NUMBER | STRING | nil | true | false | ... | tableconstructor | function body | primaryexp | ifelseexp
@ -51,12 +51,12 @@ fieldsep ::= `,' | `;'
compoundop :: `+=' | `-=' | `*=' | `/=' | `%=' | `^=' | `..=' compoundop :: `+=' | `-=' | `*=' | `/=' | `%=' | `^=' | `..='
binop ::= `+' | `-' | `*' | `/' | `^' | `%' | `..' | `<' | `<=' | `>' | `>=' | `==' | `~=' | and | or binop ::= `+' | `-' | `*' | `/' | `^' | `%' | `..' | `<' | `<=' | `>' | `>=' | `==' | `~=' | and | or
unop ::= `-' | not | `#´ unop ::= `-' | not | `#'
SimpleTypeAnnotation ::= SimpleTypeAnnotation ::=
nil | nil |
NAME[`.' NAME] [ `<' TypeAnnotation [`,' ...] `>' ] | NAME[`.' NAME] [ `<' TypeAnnotation [`,' ...] `>' ] |
`typeof' `(' expr `)' | `typeof' `(' exp `)' |
`{' [PropList] `}' | `{' [PropList] `}' |
FunctionTypeAnnotation FunctionTypeAnnotation