CPSyntaxTree Class Reference
Inherits from | NSObject |
Declared in | CPSyntaxTree.h CPSyntaxTree.m |
Overview
The CPSyntaxTree class represents a node in a syntax tree.
Syntax trees carry the rule that was matched to create the tree and the child elements that in order match up with the right hand side of the rule.
Tasks
Creating and Initialising a Syntax Tree
-
+ syntaxTreeWithRule:children:
Creates a syntax tree based on a rule and some child trees.
-
– initWithRule:children:
Initialises a syntax tree based on a rule and some child trees.
-
+ syntaxTreeWithRule:children:tagValues:
Creates a syntax tree based on a rule and some child trees.
-
– initWithRule:children:tagValues:
Initialises a syntax tree based on a rule and some child trees.
Configuring a Syntax Tree
-
rule
The rule matched to create this syntax tree.
property -
children
The children that match the right hand side of the matched rule.
property -
tagValues
The values of any tags found on the right hand side of the rule.
property -
– valueForTag:
Returns the value of a specific tag.
-
– childAtIndex:
Returns the child at a specific index.
Properties
children
The children that match the right hand side of the matched rule.
@property (readonly, copy) NSArray *children
Discussion
The children that match the right hand side of the matched rule.
Declared In
CPSyntaxTree.h
Class Methods
syntaxTreeWithRule:children:
Creates a syntax tree based on a rule and some child trees.
+ (id)syntaxTreeWithRule:(CPRule *)nonTerminal children:(NSArray *)children
Parameters
- nonTerminal
The rule that was matched to create this tree node.
- children
The child trees that represent the components of the right hand side of the rule.
Discussion
Creates a syntax tree based on a rule and some child trees.
Bug: Warning this method is deprecated, use syntaxTreeWithRule:children:tagValues: instead.
See Also
syntaxTreeWithRule:children:@property tagValues
Declared In
CPSyntaxTree.h
syntaxTreeWithRule:children:tagValues:
Creates a syntax tree based on a rule and some child trees.
+ (id)syntaxTreeWithRule:(CPRule *)nonTerminal children:(NSArray *)children tagValues:(NSDictionary *)tagValues
Parameters
- nonTerminal
The rule that was matched to create this tree node.
- children
The child trees that represent the components of the right hand side of the rule.
- tagValues
The values of each tag beneath the rule.
Discussion
Creates a syntax tree based on a rule and some child trees.
See Also
Declared In
CPSyntaxTree.h
Instance Methods
childAtIndex:
Returns the child at a specific index.
- (id)childAtIndex:(NSUInteger)idx
Parameters
- idx
The index of the child you want to retrieve.
Return Value
The child at that index.
Discussion
Returns the child at a specific index.
Declared In
CPSyntaxTree.h
initWithRule:children:
Initialises a syntax tree based on a rule and some child trees.
- (id)initWithRule:(CPRule *)nonTerminal children:(NSArray *)children
Parameters
- nonTerminal
The rule that was matched to create this tree node.
- children
The child trees that represent the components of the right hand side of the rule.
Discussion
Initialises a syntax tree based on a rule and some child trees.
Bug: Warning this method is deprecated, use initWithRule:children:tagValues: instead.
See Also
Declared In
CPSyntaxTree.h
initWithRule:children:tagValues:
Initialises a syntax tree based on a rule and some child trees.
- (id)initWithRule:(CPRule *)nonTerminal children:(NSArray *)children tagValues:(NSDictionary *)tagValues
Parameters
- nonTerminal
The rule that was matched to create this tree node.
- children
The child trees that represent the components of the right hand side of the rule.
- tagValues
The values of each tag beneath the rule.
Discussion
Initialises a syntax tree based on a rule and some child trees.
See Also
syntaxTreeWithRule:children:@property tagValues
Declared In
CPSyntaxTree.h