Keywords are predefined alphanumeric/underscore tokens,
which start with either a letter or an underscore.
A keyword ends before the last consecutive non-alphanumeric/underscore
character. Keywords are reserved for use by the compiler; their usage
cannot be redefined by a BAR implementation file.
Keyword ::= IgnoredKeyword | ReservedKeyword | TypeSpecifierKeyword |
TypeModifierKeyword | BooleanValueKeyword | ScriptStatementKeyword |
ConstructAndEnumKeywords | ThisMemberPointerKeyword | OperatorKeyword
Most keywords have specific contexts for usage; the use of a keyword outside a
relevant context causes an error.
Ignored Keywords
IgnoredKeyword ::= ‘const’ | ‘extern’ | ‘friend’ | ‘inline’ | ‘private’ |
‘protected’ | ‘public’ | ‘register’ | ‘static’ | ‘virtual’ | ‘volatile’
These are type modifier keywords. A BAR compiler
recognizes these keywords, but essentially ignores them (does
not assign type modifiers based on their presence or absence). These
keywords are reserved for future extensibility.
Reserved Keywords
ReservedKeyword ::= ‘operator’ | ‘delete’ | ‘typedef’ | ‘union’
These keywords are reserved for future extensibility, but have no relevant
context to a BAR compiler. The BAR compiler generates an error
if these keywords are encountered.
Type Specifier Keywords
SimpleIntegralTypeName ::= 'char' | 'short' | 'long' | 'longlong' | 'int' |
'bool'
SimpleFloatingTypeName ::= ‘float’ | ‘double’
SimpleTypeName ::= SimpleIntegralTypeName | SimpleFloatingTypeName
TypeSpecifierKeyword ::= SimpleTypeName | ‘void’
These keywords specify simple types (or the absence of a
type). These keywords are used in variable declarations, function
declarations, unit type assignments, and typecasts.
The types “bool” and “char” are functionally
identical and can be used interchangeably. The
types “int” and “long” are also functionally
identical and can be used interchangeably.
The type “void” represents the absence of a type. It is
used when specifying a function with no return value or a pointer
to an indeterminate type.
Type Modifier Keywords
TypeModifierKeyword ::= ‘signed’ | ‘unsigned’ | ‘littleendian’ | ‘bigendian’
These are keywords that modify simple types. These
keywords are used in variable declarations, function declarations, unit
type assignments, and typecasts.
Boolean Value Keywords
BooleanValueKeyword ::= ‘true’ | ‘false’
The keywords true and false are symbolic
representations of, respectively, the numbers 1 and 0.
These keywords can be used anywhere a number is expected.
Script Statement Keywords
ScriptStatementKeyword ::= ‘break’ | ‘case’ | ‘continue’ | ‘default’ | ‘do’
| ‘else’ | ‘for’ | ‘goto’ | ‘if’ | ‘return’ | ‘switch’ | ‘while’
These keywords are used in functions to denote script statements.
These keywords are found inside function bodies.
Construct and Enumerated Constant Block Keywords
ConstructAndEnumKeywords ::= ‘enum’ | ‘class’ | ‘struct’ |
‘fileformatframework’ | ‘block’ | ‘nodelist’ | ‘choice’
These keywords are used to indicate formal declarations of
implementation file components.
Construct Definition Keywords
ConstructDefinitionKeywords ::= ‘bitfield’ | ‘unittype’ | ‘organized’ |
‘unorganized’ | ‘textual’ | ‘bitscan’ | ‘mainheader’ | ‘mainbody’ | ‘optional’
| ‘repeats’ | ‘discardable’ | ‘nofragment’ | ‘autoterminate’
These keywords are used within constructs definitions.
The “this” member pointer keyword
ThisMemberPointerKeyword ::= ‘this’
The ‘this’ keyword can be used in member functions to retrieve
the member pointer associated with the member function
call. This keyword cannot be used in global functions.
Operator Keywords
OperatorKeyword ::= ‘debugmsg’ | ‘sizeof’ | ‘new’ | ‘newchild’ | ‘round’ |
‘floor’ | ‘ceil’ | ‘abs’ | ‘sgn’ | ‘sin’ | ‘cos’ | ‘tan’ | ‘log10’ | ‘log’ |
‘exp’ | ‘sqrt’ | ‘atan’ | ‘atan2’ | ‘asin’ | ‘acos’ | ‘sinh’ | ‘cosh’ | ‘tanh’
| ‘asinh’ | ‘acosh’ | ‘atanh’ | ‘rand’ | ‘powr’ | ‘modf’ | ‘getparent’ |
‘getnext’ | ‘getprevious’ | ‘getchild’ | ‘getsize’ | ‘getbitsize’ | ‘getuid’ |
‘getname’ | ‘getuidfromname’ | ‘getchildcount’ | ‘getrelpos’ | ‘gethlevel’ |
‘getnodetype’
These keywords act as operators in the context of a function
body.
Whitespace is needed to separate two consecutive
keywords. Whitespace is not necessary to separate keywords from
non-alphanumeric/underscore tokens.
See also: [Punctuators] [Operators]
[Keywords]
[Identifiers] [Numbers]
[String literals] [Remarks]
[Preprocessor directives] [Whitespace]
[Unrecognized characters]
|