Class ASyntaxRuleset
Unit
parsing
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
Overview
Methods
|
function init: boolean; override; |
|
function addRule(const ThisRule: ASyntaxRule; const freeOnFailure: boolean = false): boolean; virtual; |
|
function addNewRule(const thisKey: TSortKey; const thisList: array of TOpcode): boolean; virtual; |
|
function Rule(const thisKey: TSortKey): ASyntaxRule; virtual; |
Description
Methods
|
function init: boolean; override; |
Initializer
|
|
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.
|
|
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
|
|
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
|