2.5.198.104 Rgce
The Rgce structure specifies a set of Ptgs, laid out sequentially in the file.
The sequence of Ptgs MUST adhere to the following grammar.
EXPRESSION_SIZE is the sum of the sizes of a contiguous set of Ptgs in bytes.
The ACTUAL_PTG_SIZE of a Ptg is as follows:
-
Ptg
ACTUAL_PTG_SIZE
1 + (stringsize + 1) * 2
where stringsize is the string.cch field of the PtgStr structure
15
7
13
7
13
7
13
9
15
9
16
Any other Ptg
Size of the Ptg in bytes
The ACTUAL_EXPRESSION_SIZE of a contiguous set of Ptgs is the sum of ACTUAL_PTG_SIZEs of those Ptgs. The ACTUAL_EXPRESSION_SIZE of all Ptgs in an Rgce MUST be less than or equal to 1800.
rgce = PtgExp / PtgTbl / [PtgAttrBaxcel / PtgAttrSemi / PtgAttrSpaceSemi] expression
expression = *PtgAttrSpace base-expression
-
The value of the type field of each PtgAttrSpace in an expression MUST be 0, 1, or 6.
base-expression = operand / unary-expression / binary-reference-expression / binary-value-expression / display-precedence-specifier / mem-area-expression / function-call
operand = PtgMissArg / PtgStr / PtgErr / PtgBool / PtgInt / PtgNum / PtgArray / PtgName / PtgRef / PtgArea / PtgRefErr / PtgAreaErr / PtgRefN / PtgAreaN / PtgNameX / PtgRef3d / PtgArea3d / PtgRefErr3d / PtgAreaErr3d / PtgElfLel / PtgElfRw / PtgElfCol / PtgElfRwV / PtgElfColV / PtgElfRadical PtgArea / PtgElfRadical PtgAreaErr / PtgElfRadicalS PtgArea / PtgElfRadicalS PtgAreaErr / PtgElfColS / PtgElfColSV / PtgElfRadicalLel PtgArea / PtgElfRadicalLel PtgAreaErr / PtgSxName
-
Each Ptg in this definition is an operand token.
unary-expression = val unary-operator
-
Each Ptg in this definition is an operator token.
binary-reference-expression = 2ref binary-reference-operator
-
Each Ptg in this definition is an operator token.
binary-value-expression = 2val binary-value-operator
binary-value-operator = PtgAdd / PtgSub / PtgMul / PtgDiv / PtgPower / PtgConcat / PtgLt / PtgLe / PtgEq / PtgGe / PtgGt / PtgNe
-
Each Ptg in this definition is an operator token.
display-precedence-specifier = expression [PtgAttrSpace] PtgParen
-
The value of the type field of a PtgAttrSpace MUST be between 2 and 5 inclusive.
-
PtgAttrSpace and PtgParen are display tokens.
mem-area-expression = mem-ptg binary-reference-expression
-
The cce field in the Ptg of the mem-ptg rule MUST be equal to the EXPRESSION_SIZE of the Ptgs that comprise the binary-reference-expression.
-
If mem-ptg is not PtgMemFunc then the expression elements in the binary-reference-expression MUST NOT contain any mem-ptg elements, PtgFunc, PtgFuncVar, PtgName, PtgNameX, PtgRef3d, PtgArea3d, PtgRefErr3d, or PtgAreaErr3d.
mem-ptg = PtgMemArea / PtgMemErr / PtgMemNoMem / PtgMemFunc
-
Each Ptg in this definition is a mem token.
function-call = if-expression / choose-expression / [params-fixed] PtgFunc / params-variable PtgFuncVar / params-cetab PtgFuncVar / expression PtgAttrSum
-
The params-fixed element MUST NOT be specified if PtgFunc specifies a function that takes no parameters. Otherwise, it MUST conform to the ABNF rule for the function specified by PtgFunc.
if-expression = expression PtgAttrIf 1*2(expression PtgAttrGoto) PtgFuncVar
-
The value of the offset field in the PtgAttrIf MUST be equal to the EXPRESSION_SIZE of all Ptgs in the if-expression after the PtgAttrIf through the first PtgAttrGoto.
-
The value of the offset field in each PtgAttrGoto MUST be equal to one less than the EXPRESSION_SIZE of all Ptgs remaining in the if-expression after that PtgAttrGoto.
-
The value of the fCeFunc field of the PtgFuncVar MUST be zero. The value of the tab field of the PtgFuncVar MUST be 0x0001, which represents the IF function.
choose-expression = expression PtgAttrChoose 1*29(expression PtgAttrGoto) PtgFuncVar
-
The value of the cOffset field in the PtgAttrChoose MUST be equal to the number of times the expression in the repeated sequence group appears.
-
The first offset in the array of offsets in the rgOffset field in the PtgAttrChoose MUST be equal to four less than the size of the PtgAttrChoose in bytes.
-
For the nth occurrence of the repeated sequence group, the (n+1)th offset in the array of offsets in the rgOffset field in the PtgAttrChoose MUST be equal to the EXPRESSION_SIZE of all Ptgs in the choose-expression after the PtgAttrChoose through the nth PtgAttrGoto.
-
The value of the offset field in each PtgAttrGoto MUST equal one less than the EXPRESSION_SIZE of all Ptgs remaining in the choose-expression after that PtgAttrGoto.
-
The value of the fCeFunc field of the PtgFuncVar MUST be zero. The value of the tab field of the PtgFuncVar MUST be 0x0064, which represents the CHOOSE function.
val = expression
-
Additional restrictions are specified under VALUE_TYPE. The params-fixed, params-variable and params-cetab rules also use val.
ref = expression
-
Additional restrictions are specified under VALUE_TYPE. The params-fixed, params-variable and params-cetab rules also use ref.
If the value of the useselfs field of the UsesELFs record is zero then an Rgce MUST NOT contain PtgElfLel, PtgElfRw, PtgElfCol, PtgElfRwV, PtgElfColV, PtgElfRadical, PtgElfRadicalS, PtgElfColS, PtgElfColSV, and PtgElfRadicalLel.
PtgElfLel, PtgElfRw, PtgElfCol, PtgElfRwV, PtgElfColV, PtgElfRadical, PtgElfRadicalS, PtgElfColS, PtgElfColSV, and PtgElfRadicalLel SHOULD NOT<178> be used.
Additional restrictions on the contents of this structure are specified in terms of a parse tree. For this purpose, a parse tree is a means of organizing the components of an Rgce. Each node in the parse tree represents a Ptg or an ABNF rule described previously. Non-leaf nodes represent rules and have one child node for each element in the rule. Leaf nodes represent only a Ptg.
For a leaf node in the parse tree, NESTING_DEPTH is the number of function-call nodes in the path from the root node to that leaf.
For a node in the parse tree, OPERAND_COUNT is as follows:
The OPERAND_COUNT of each Ptg appearing in the operand rule definition is one.
The OPERAND_COUNT of all other Ptgs is zero.
The OPERAND_COUNT of a node that has n child nodes with nonzero OPERAND_COUNT is equal to the maximum, across all the n child nodes, of (n-1) plus the OPERAND_COUNT of the nth child that has nonzero OPERAND_COUNT.
For a node in the parse tree, VALUE_TYPE is a state indicating that the node represents a single value of a simple type or an array of such values. A node that is not a VALUE_TYPE represents a reference to a range. Elements in an expression MUST represent either values or references, based on the specific Ptgs used in the expression. The following rules specify how to traverse the parse tree from the bottom up and determine whether each node is a VALUE_TYPE, which determines whether the sequence of Ptgs comprising the formula correctly satisfies the requirements of each expression in the formula. A node is determined to be a VALUE_TYPE as follows:
Leaf nodes:
PtgMissArg, PtgStr, PtgSxName, PtgErr, PtgBool, PtgInt, PtgNum, PtgArray, PtgRefErr, PtgAreaErr, PtgRefErr3d, PtgAreaErr3d, PtgElfLel, PtgElfRwV, PtgElfColV, PtgElfColSV, PtgElfRadicalLel, PtgUplus, PtgUminus, PtgPercent, PtgAdd, PtgSub, PtgMul, PtgDiv, PtgPower, PtgConcat, PtgLt, PtgLe, PtgEq, PtgGe, PtgGt, and PtgNe leaf nodes are VALUE_TYPEs.
PtgName, PtgRef, PtgArea, PtgRefN, PtgAreaN, PtgNameX, PtgRef3d, PtgArea3d, PtgFunc, PtgFuncVar, PtgMemArea, PtgMemErr, PtgMemNoMem, and PtgMemFunc leaf nodes are VALUE_TYPEs if and only if the value of the type field is value or array.
All other leaf nodes are not VALUE_TYPEs.
Non-leaf nodes:
Any non-leaf node with a single child node MUST be a VALUE_TYPE if and only if the child node is a VALUE_TYPE.
Any non-leaf node with a mem-ptg, unary-operator, binary-value-operator, binary-reference-operator, PtgAttrSum, PtgFunc or PtgFuncVar child node is a VALUE_TYPE if and only if that child node is a VALUE_TYPE. Other child nodes are ignored for the purposes of determining whether the non-leaf node is a VALUE_TYPE.
Any non-leaf node corresponding to a val rule MUST be a VALUE_TYPE.
Any non-leaf node corresponding to a ref rule MUST NOT be a VALUE_TYPE.
Otherwise, a non-leaf node with an expression child node is a VALUE_TYPE if and only if that expression child node is a VALUE_TYPE.
A parse tree for an Rgce MUST meet the following conditions:
The NESTING_DEPTH of each leaf node MUST NOT exceed 8.
The OPERAND_COUNT of the root node MUST NOT exceed 40.
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sequence (variable) |
|||||||||||||||||||||||||||||||
... |
sequence (variable): An array of Ptg that specifies the sequence of Ptgs.