linearc.ppIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers Classes hierarchy graph
|
Class ALinearCCompoundExpression
Unit
linearc
Declaration
type ALinearCCompoundExpression = class(ALinearCExpression)
Description
This class represents a compound expression in LinearC, which can be made up of one or more subexpressions.
Hierarchy
Overview
Fields
Methods
Description
Fields
|
myOperation: TOpcode; |
Refers to the operator encountered, if any
|
Methods
|
function parse: int64; override; |
Parse the expression.
This method assembles the values represented by each subexpression within its scope and, for each pair of expressions, performs an operation on them. The resulting value is stored as the compound expression's value.
The subexpressions are parsed by constructing an instance of ALinearCExpression and calling its parse method.
This method is not typically called directly; instead, it is called from one of the parseUntil() methods, such as ALinearCCompoundExpression.parseUntilToken. This is because the class represents a collection of expressions which is made up of one or more individual expressions.
|
|
function parseSubexpression: int64; virtual; |
Parse a subexpression.
This method is called automatically by ALinearCCompoundExpression.parse. It checks to ensure that the current token represents a valid expression beginning, then creates an instance of ALinearCExpression to parse the expression.
|
|
function performArithmeticOperation: boolean; virtual; |
Perform an arithmetic operation that involves Self.value and the value of Self.CurrentElement.
The type of value stored in Self.value determines the type of operation performed:
If Self.value is a string value, then Self.CurrentElement is cast as a string and then:
If Self.value is a floating-point or integer value, then the value of Self.CurrentElement is cast to the appropriate type and the relevant mathematical operation is performed. For division and modulus division, the method ensures that the value of Self.CurrentElement is not zero (0 ) so as to avoid division-by-zero errors.
For all other types, this method fails and returns False .
If an exception is thrown when attempting to cast the value of Self.CurrentElement to the correct type, this method will exit and the caller is expected to handle the exception. When called from ALinearCCompoundExpression.performOperation, a syntax error message is generated in response to the exception.
Returns
True if the operation was successfully performed; False otherwise.
|
|
function performBitwiseOperation: boolean; virtual; |
Perform a bitwise or logical operation that involves Self.value and the value of Self.CurrentElement.
The type of value stored in Self.value determines the type of operation performed:
If an exception is thrown when attempting to cast the value of Self.CurrentElement to the correct type, this method will exit and the caller is expected to handle the exception. When called from ALinearCCompoundExpression.performOperation, a syntax error message is generated in response to the exception.
Returns
True if the operation was successfully performed; False otherwise.
|
|
function performEqualityTestOperation: boolean; virtual; |
Perform an equality-test operation that involves Self.value and the value of Self.CurrentElement.
The type of value stored in Self.value determines the type of operation performed:
If Self.value is a string, then the value of Self.CurrentElement is cast as a string and SysUtils.ansiCompareStr is used to determine the relative equality of the two string values.
If Self.value is an integer value or a floating point value Self.CurrentElement is cast to the appropriate type and the relevant equality test is performed.
For all other types, this method fails and returns False .
If an exception is thrown when attempting to cast the value of Self.CurrentElement to the correct type, this method will exit and the caller is expected to handle the exception. When called from ALinearCCompoundExpression.performOperation, a syntax error message is generated in response to the exception.
Returns
True if the operation was successfully performed; False otherwise.
|
|
function operation: TOpcode; |
Retrieve the operator encountered while parsing the compound expression, if any.
Although a compound expression will generally consist of two or more subexpressions, separated by an operator, this is not required. It is perfectly valid for a compound expression to consist of a single subexpression with no operators, in which case this method will return zero (0).
|
Generated by PasDoc 0.13.0 on 2015-06-25 11:07:51
|