Class ASyntaxRuleset

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ASyntaxRuleset = class(ABinaryTree)

Description

This class represents a collection of syntax rules which, taken together, help to control how a parser processes source.

The collection of rules is implemented as a binary tree: rules can be added and removed, and can be retrieved by their sort key, which can be an integer value. Rulesets can also be written to and read from arbitrary streams. For more information, see ABinaryTree.

Hierarchy

  • ASyntaxRuleset

Overview

Methods

Public function init: boolean; override;
Public function addRule(const ThisRule: ASyntaxRule; const freeOnFailure: boolean = false): boolean; virtual;
Public function addNewRule(const thisKey: TSortKey; const thisList: array of TOpcode): boolean; virtual;
Public function Rule(const thisKey: TSortKey): ASyntaxRule; virtual;

Description

Methods

Public function init: boolean; override;

Initializer

Public function addRule(const ThisRule: ASyntaxRule; const freeOnFailure: boolean = false): boolean; virtual;

Add the given rule to the ruleset.

This method simply calls ABinaryTree.addLeaf on itself and returns the result. It is defined for convenience.

Public function addNewRule(const thisKey: TSortKey; const thisList: array of TOpcode): boolean; virtual;

Add a rule with the specified sort key to the ruleset.

This method constructs an instance of ASyntaxRule that is identified by thisKey by calling ASyntaxRule.withIdentifier. It then attempts to add the rule to the ruleset by calling ASyntaxRuleset.addRule on Self.

.

Returns

True if the new rule was successfully created and inserted; False if not

Public function Rule(const thisKey: TSortKey): ASyntaxRule; virtual;

Retrieve a reference to the rule with the specified sort key.

This method calls ABinaryTree.fetchLeaf on itself, then returns a reference to the resulting rule, if found. If the rule is not found, then this method returns Nil.

The caller should NOT attempt to free the reference returned by this routine.


Generated by PasDoc 0.13.0 on 2015-06-25 11:12:03