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

Configuring a Syntax Tree

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

rule

The rule matched to create this syntax tree.

@property (readonly, retain) CPRule *rule

Discussion

The rule matched to create this syntax tree.

Declared In

CPSyntaxTree.h

tagValues

The values of any tags found on the right hand side of the rule.

@property (readonly, copy) NSDictionary *tagValues

Discussion

The values of any tags found on the right hand side of the 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.

Return Value

Returns a syntax tree with apropriate children, and matching a specified 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

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.

Return Value

Returns a syntax tree with apropriate children, and matching a specified rule.

Discussion

Creates a syntax tree based on a rule and some child trees.

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.

Return Value

Returns a syntax tree with apropriate children, and matching a specified 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.

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.

Return Value

Returns a syntax tree with apropriate children, and matching a specified rule.

Discussion

Initialises a syntax tree based on a rule and some child trees.

See Also

Declared In

CPSyntaxTree.h

valueForTag:

Returns the value of a specific tag.

- (id)valueForTag:(NSString *)tagName

Parameters

tagName

The name of the tag you want the value of.

Return Value

The sub syntax tree associated with that tag.

Discussion

Returns the value of a specific tag.

Declared In

CPSyntaxTree.h