Package lepl :: Package regexp :: Module core :: Class NfaGraph
[hide private]
[frames] | no frames]

Class NfaGraph

source code


Describes a NFA with epsilon (empty) transitions.
Instance Methods [hide private]
 
__init__(self, alphabet)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
new_node(self)
Get a new (unconnected) node.
source code
 
connect(self, src, dest, edge=None)
Define a connection between src and dest, with an optional edge value (a character).
source code
 
empty_transitions(self, src)
An iterator over all empty transitions from src.
source code
 
connected(self, nodes)
Return all nodes connected to the given node.
source code
 
terminal(self, node)
The NFA graph has single terminal.
source code
 
__str__(self)
Example: 0: 3, 4; 1: 2; 2(Tk1); 3: [{u''}-`b-{u'U0010ffff'}]->3, 1; 4: {$}->5, 7; 5: 6; 6($); 7: {^}->10; 8: 9; 9(^); 10: 11; 11: [ ]->11, 8
source code

Inherited from BaseGraph: __iter__, __len__, terminals, terminate, transitions

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, alphabet)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

new_node(self)

source code 
Get a new (unconnected) node.
Overrides: BaseGraph.new_node

connect(self, src, dest, edge=None)

source code 
Define a connection between src and dest, with an optional edge value (a character).
Overrides: BaseGraph.connect

__str__(self)
(Informal representation operator)

source code 

Example: 0: 3, 4; 1: 2; 2(Tk1); 3: [{u''}-`b-{u'U0010ffff'}]->3, 1; 4: {$}->5, 7; 5: 6; 6($); 7: {^}->10; 8: 9; 9(^); 10: 11; 11: [ ]->11, 8

Node 0 leads to 3 and 4 (both empty) Node 1 leads to 2 (empty) Node 2 is terminal, labelled with "Tk1" Node 3 loops back to 3 for a character in the given range, or to 1 etc.

Overrides: object.__str__