Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cmt_or_node Class Reference

Inheritance diagram for cmt_or_node:

Inheritance graph
[legend]
Collaboration diagram for cmt_or_node:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 cmt_or_node (cmt_regexp_node_set *father)
const cmt_regexp::iterator match (const cmt_string &text, int pos) const
void dump () const

Constructor & Destructor Documentation

cmt_or_node::cmt_or_node cmt_regexp_node_set father  ) 
 

Definition at line 1092 of file cmt_regexp.cxx.

01092                                                      : cmt_regexp_node_set (father)
01093 {
01094 }


Member Function Documentation

void cmt_or_node::dump  )  const [virtual]
 

Reimplemented from cmt_regexp_node_set.

Definition at line 1136 of file cmt_regexp.cxx.

References cmt_regexp_node_set::dump().

01137 {
01138   cmt_regexp_node_set::dump ("or");
01139 }

const cmt_regexp::iterator cmt_or_node::match const cmt_string text,
int  pos
const [virtual]
 

Reimplemented from cmt_regexp_node.

Definition at line 1096 of file cmt_regexp.cxx.

References cmt_regexp::iterator::_length, cmt_regexp_node::match(), cmt_regexp::iterator::null(), cmt_vector< cmt_regexp_node * >::size(), cmt_string::size(), tab(), tab_level, and CmtSystem::testenv().

01098 {
01099   if ((pos < 0) || (pos >= text.size ())) 
01100     {
01101       return (cmt_regexp::iterator::null ());
01102     }
01103 
01104   if (_nodes.size () == 0) return (cmt_regexp::iterator (pos, 0));
01105   
01106   bool dbg = CmtSystem::testenv ("CMTTESTREGEXP");
01107   if (dbg) {tab (); cout << "match or (" << this << ") pos=" << pos << endl;}
01108 
01109   int i;
01110 
01111   int longest = 0;
01112 
01113   cmt_regexp::iterator result = cmt_regexp::iterator::null ();
01114   
01115   for (i = 0; i < _nodes.size (); i++)
01116     {
01117       const cmt_regexp_node* n = _nodes[i];
01118       
01119       if (dbg) tab_level++;
01120       const cmt_regexp::iterator it = n->match (text, pos);
01121       if (dbg) tab_level--;
01122 
01123       if (it._length > longest)
01124         {
01125           longest = it._length;
01126           result = it;
01127         }
01128 
01129         //        at least one or-ed expression matches
01130       // if (it != cmt_regexp::iterator::null ()) return (it);
01131     }
01132   
01133   return (result);
01134 }


The documentation for this class was generated from the following file:
Generated on Mon May 2 10:25:30 2005 for CMT by doxygen 1.3.5