Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <regex>
00031
00032 namespace std _GLIBCXX_VISIBILITY(default)
00033 {
00034 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00035
00036 namespace __regex
00037 {
00038 #ifdef _GLIBCXX_DEBUG
00039 inline std::ostream& _State::
00040 _M_print(std::ostream& ostr) const
00041 {
00042 switch (_M_opcode)
00043 {
00044 case _S_opcode_alternative:
00045 ostr << "alt next=" << _M_next << " alt=" << _M_alt;
00046 break;
00047 case _S_opcode_subexpr_begin:
00048 ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr;
00049 break;
00050 case _S_opcode_subexpr_end:
00051 ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr;
00052 break;
00053 case _S_opcode_match:
00054 ostr << "match next=" << _M_next;
00055 break;
00056 case _S_opcode_accept:
00057 ostr << "accept next=" << _M_next;
00058 break;
00059 default:
00060 ostr << "unknown next=" << _M_next;
00061 break;
00062 }
00063 return ostr;
00064 }
00065
00066
00067 inline std::ostream& _State::
00068 _M_dot(std::ostream& __ostr, _StateIdT __id) const
00069 {
00070 switch (_M_opcode)
00071 {
00072 case _S_opcode_alternative:
00073 __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n"
00074 << __id << " -> " << _M_next
00075 << " [label=\"epsilon\", tailport=\"s\"];\n"
00076 << __id << " -> " << _M_alt
00077 << " [label=\"epsilon\", tailport=\"n\"];\n";
00078 break;
00079 case _S_opcode_subexpr_begin:
00080 __ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
00081 << _M_subexpr << "\"];\n"
00082 << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
00083 break;
00084 case _S_opcode_subexpr_end:
00085 __ostr << __id << " [label=\"" << __id << "\\nSEND "
00086 << _M_subexpr << "\"];\n"
00087 << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
00088 break;
00089 case _S_opcode_match:
00090 __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n"
00091 << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
00092 break;
00093 case _S_opcode_accept:
00094 __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
00095 break;
00096 default:
00097 __ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n"
00098 << __id << " -> " << _M_next << " [label=\"?\"];\n";
00099 break;
00100 }
00101 return __ostr;
00102 }
00103
00104 inline std::ostream& _Nfa::
00105 _M_dot(std::ostream& __ostr) const
00106 {
00107 __ostr << "digraph _Nfa {\n"
00108 << " rankdir=LR;\n";
00109 for (unsigned int __i = 0; __i < this->size(); ++__i)
00110 { this->at(__i)._M_dot(__ostr, __i); }
00111 __ostr << "}\n";
00112 return __ostr;
00113 }
00114 #endif
00115
00116 inline _StateSeq& _StateSeq::
00117 operator=(const _StateSeq& __rhs)
00118 {
00119 _M_start = __rhs._M_start;
00120 _M_end1 = __rhs._M_end1;
00121 _M_end2 = __rhs._M_end2;
00122 return *this;
00123 }
00124
00125 inline void _StateSeq::
00126 _M_push_back(_StateIdT __id)
00127 {
00128 if (_M_end1 != _S_invalid_state_id)
00129 _M_nfa[_M_end1]._M_next = __id;
00130 _M_end1 = __id;
00131 }
00132
00133 inline void _StateSeq::
00134 _M_append(_StateIdT __id)
00135 {
00136 if (_M_end2 != _S_invalid_state_id)
00137 {
00138 if (_M_end2 == _M_end1)
00139 _M_nfa[_M_end2]._M_alt = __id;
00140 else
00141 _M_nfa[_M_end2]._M_next = __id;
00142 _M_end2 = _S_invalid_state_id;
00143 }
00144 if (_M_end1 != _S_invalid_state_id)
00145 _M_nfa[_M_end1]._M_next = __id;
00146 _M_end1 = __id;
00147 }
00148
00149 inline void _StateSeq::
00150 _M_append(_StateSeq& __rhs)
00151 {
00152 if (_M_end2 != _S_invalid_state_id)
00153 {
00154 if (_M_end2 == _M_end1)
00155 _M_nfa[_M_end2]._M_alt = __rhs._M_start;
00156 else
00157 _M_nfa[_M_end2]._M_next = __rhs._M_start;
00158 _M_end2 = _S_invalid_state_id;
00159 }
00160 if (__rhs._M_end2 != _S_invalid_state_id)
00161 _M_end2 = __rhs._M_end2;
00162 if (_M_end1 != _S_invalid_state_id)
00163 _M_nfa[_M_end1]._M_next = __rhs._M_start;
00164 _M_end1 = __rhs._M_end1;
00165 }
00166
00167
00168 inline _StateIdT _StateSeq::
00169 _M_clone()
00170 { return 0; }
00171
00172 }
00173
00174 _GLIBCXX_END_NAMESPACE_VERSION
00175 }