-
Notifications
You must be signed in to change notification settings - Fork 10
Grammar
Positron edited this page Mar 3, 2015
·
13 revisions
library: region-body (empty) region: region region-name { } region region-name { region-body } region-name: identifier region-name :: identifier region-body: region-item region-body region-item region-item: region import-statement directive declaration script ; import-statement: import import-list ; import import-list , import-selection ; import import-selection ; import-list: import-item import-list , import-item import-item: import-alias path import-alias path :: * import-alias: identifier = (empty) import-selection: import-alias path : import-selection-list import-selection-list: import-selection-item import-selection-list , import-selection-item import-selection-item: import-alias identifier import-alias path :: * struct import-alias identifier enum import-alias identifier import-selection-item-deprecated import-selection-item-deprecated: identifier = region region = identifier region = region path: upmost region identifier path :: identifier directive: # directive-body // The parsing of the directive body depends on the value of the // directive name. Below, each rule starts with a specific name. // The name is in bold, but it is not a keyword. directive-body: include string import string library string encryptstrings define libdefine nocompact // Not supported in bcc: // - wadauthor // - nowadauthor declaration: qualifier storage specifier ; qualifier storage specifier variable-list ; qualifier storage specifier function function qualifier storage specifier function qualifier: static (empty) storage: world global (empty) storage-index: decimal-number : (empty) specifier: int str bool void enumeration structure enumeration: enum { enumerator-list } enum { enumerator-list , } enumerator-list: enumerator enumerator-list , enumerator enumerator: identifier identifier = expression structure: struct { structure-member-list } struct identifier { structure-member-list } struct path structure-member-list: declaration structure-member-list declaration variable-list: variable variable-list , variable variable: storage-index identifier dimension initial dimension: dimension-list (empty) dimension-list: [ ] [ expression ] dimension-list [ ] dimension-list [ expression ] initial: = expression = multi-value (empty) multi-value: { multi-value-list } { multi-value-list , } multi-value-list: expression multi-value multi-value-list , expression multi-value-list , multi-value function: storage-index identifier ( ) block-statement storage-index identifier ( void ) block-statement storage-index identifier ( parameter-list ) block-statement parameter-list: parameter parameter-list , parameter parameter: parameter-specifier parameter-name parameter-specifier parameter-name = expression parameter-specifier: int str bool parameter-name: identifier (empty) manifest-constant: enum identifier = expression ; script: script script-id script-parameter-list script-type script-flag statement script-id: << 0 >> // Function calls are ignored when parsing the expression because they // conflict with the start of the parameter list. expression script-parameter-list: ( ) ( void ) ( parameter-list ) (empty) script-type: open respawn death enter pickup bluereturn redreturn whitereturn lightning unloading disconnect return event (empty) script-flag: script-flag-list (empty) script-flag-list: net clientside script-flag-list net script-flag-list clientside statement: block-statement if ( expression ) statement if ( expression ) statement else statement switch ( expression ) statement while ( expression ) statement until ( expression ) statement do statement while ( expression ) ; do statement until ( expression ) ; for ( for-initialization for-condition for-increment ) statement break ; continue ; terminate ; suspend ; restart ; return ; return expression ; return expression := block-statement goto identifier ; assert-statement format-item ; palette-translation ; inline-assembly expression ; expression := block-statement ; block-statement: { } { block-statement-item-list } block-statement-item-list: block-statement-item block-statement-item-list block-statement-item block-statement-item: declaration identifier : case expression : default : import-statement statement for-initialization: declaration expression-list ; ; for-condition: expression ; ; for-increment: expression-list (empty) palette-translation: createtranslation ( expression ) createtranslation ( expression , palette-range-list ) palette-range-list: palette-range palette-range-list , palette-range palette-range: // Assignment is ignored in the second expression because it will conflict // with the assignment token that follows. expression : expression = palette-range-value palette-range-value: expression : expression [ expression , expression , expression ] : [ expression , expression , expression ] format-item: format-cast := expression format-item , format-cast := expression assert-statement: assert ( expression ) ; assert ( expression , string ) ; static assert ( expression ) ; static assert ( expression , string ) ; // The newline character becomes significant for inline-assembly. // It is the terminating token of a line of inline-assembly code. inline-assembly: > identifier newline > identifier inline-assembly-argument-list newline inline-assembly-argument-list: expression inline-assembly-argument-list , expression
Certain identifiers are reserved by the language and are used in specific ways. They cannot be used as names for your own objects. These identifiers are:
bluereturn
bool
break
case
clientside
const
continue
createtranslation
death
default
disconnect
do
else
enter
enum
false
for
function
global
goto
if
import
int
lightning
net
open
pickup
redreturn
region
respawn
restart
return
script
static
str
struct
suspend
switch
terminate
true
unloading
until
upmost
void
while
whitereturn
world
--
The following identifiers are reserved but are not used:
fixed
special
--
The following identifiers are no longer reserved and can be used as names for your own objects:
acs_executewait
define
encryptstrings
hudmessage
hudmessagebold
include
libdefine
library
log
nocompact
nowadauthor
print
printbold
strcpy
strparam
wadauthor