Block scope is the context just inside the braces
associated with a block definition.
BlockDefinition ::= OrganizedBlockDefinition | UnorganizedBlockDefinition |
RegExpBlockDefinition
There are three different subsets of block definition, based on
whether the block is organized or unorganized.
A special definition subtype of unorganized block is a regular expression
block, defined to conform to a pattern defined by a regular
expression.
MemberFunctionDeclaration ::= FunctionDeclaration
FunctionDeclaration ::= (DataStructureType | ‘void’) S (‘*’)? S?
IdentifierName S? ‘(‘ S? ParameterList S? ‘)’ S? ‘{‘ S? FunctionBodyDefinition
S? ‘}’ S? ‘;’
For member function declarations in block definitions,
the function name uniquely identifies the function. The name
is an identifier that has not appeared earlier in the
definition as a construct name, an enumerated constant
block name, an enumerated constant name, or a
member function name.
Member functions can be declared in both organized block
definitions and unorganized block definitions.
There are no member functions for regular expression block definitions.
It should be noted that member functions, as they exist in most
programming languages, require that an actual structure be
used to serve as the scope. In BAR, this is not necessarily the
case. Member functions for structures have the same
principles as those found for structures in other languages, but block-based
member functions do not have other-language equivalents.
From a programming standpoint, the biggest uncertainty regarding member
functions of blocks is how the 'this' pointer is
implemented. If there are no structured members, the 'this'
pointer must take on a different meaning.
For organized blocks, the 'this' pointer is
treated as a pointer to a node handle. Many operators,
such as getnext or getsize, can use this
pointer to locate other nodes and query information.
For unorganized blocks, the 'this' pointer is
treated as either a pointer to a node handle (if block is
empty) or a pointer to the first byte of data in the block (if
block is not empty).
See also: [Organized block
definitions] [Unorganized block
definitions] [Regular Expression block
definitions]
|