Class ALinearCExpression

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ALinearCExpression = class(ALinearCStatement)

Description

This class represents an expression in LinearC. An expression can be made up of a numeric value, a boolean value, or a subexpression (delimited by parentheses). You will probaly not create a direct instance of this class, since it cannot implement any parsing routines on its own.

Hierarchy

Overview

Fields

Protected myValue: Variant;

Methods

Public constructor forSource(const ThisParent: AParser); overload; override;
Public function init: boolean; override;
Public destructor destroy; override;
Public function parse: int64; override;
Public function toString: AnsiString; override;
Public function value: Variant; virtual;

Description

Fields

Protected myValue: Variant;

Stores the value of the expression

Methods

Public constructor forSource(const ThisParent: AParser); overload; override;

Construct a new expression parser that will use the same scanner and token list as the specified parser.

The new expression inherits all of the properties of ThisParser.

Public function init: boolean; override;

Initializer

Public destructor destroy; override;

Destroy the expression.

Since instances of ALinearCExpression borrow the tokens list reference of their parent, this method sets its copy of that reference to Nil in order to prevent the inherited destructor code from freeing a reference that does not belong to it. It then calls the inherited destructor.

Public function parse: int64; override;

Parse the expression.

This method checks Self.CurrentToken and, based on the value of the opcode, this method will construct an instance of:

The value returned from the subexpression will be assigned to Self.value.

Returns

The number of errors encountered while parsing.

Public function toString: AnsiString; override;

Construct and return a string representation of the expression, suitable for output to a text-based device such as a console.

This method calls Variants.varToStr on Self.value and returns the result.

Public function value: Variant; virtual;

Retrieve the current value of the expression.

This value is calculated as the expression is parsed and cannot otherwise be changed.


Generated by PasDoc 0.13.0 on 2015-06-25 11:07:51