1 // class template regex -*- C++ -*-
3 // Copyright (C) 2010, 2011 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
26 * @file bits/regex_compiler.h
27 * This is an internal header file, included by other library headers.
28 * Do not attempt to use it directly. @headername{regex}
31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
39 typedef unsigned int _StateT;
41 static constexpr _StateT _S_state_at_start = 1 << 0;
42 static constexpr _StateT _S_state_in_brace = 1 << 2;
43 static constexpr _StateT _S_state_in_bracket = 1 << 3;
47 // @brief Scans an input range for regex tokens.
49 // The %_Scanner class interprets the regular expression pattern in the input
50 // range passed to its constructor as a sequence of parse tokens passed to
51 // the regular expression compiler. The sequence of tokens provided depends
52 // on the flag settings passed to the constructor: different regular
53 // expression grammars will interpret the same input pattern in
54 // syntactically different ways.
56 template<typename _InputIterator>
57 class _Scanner: public _Scanner_base
60 typedef _InputIterator _IteratorT;
61 typedef typename std::iterator_traits<_IteratorT>::value_type _CharT;
62 typedef std::basic_string<_CharT> _StringT;
63 typedef regex_constants::syntax_option_type _FlagT;
64 typedef const std::ctype<_CharT> _CtypeT;
66 // Token types returned from the scanner.
71 _S_token_bracket_begin,
73 _S_token_inverse_class,
74 _S_token_char_class_name,
77 _S_token_collelem_multi,
78 _S_token_collelem_single,
84 _S_token_equiv_class_name,
85 _S_token_interval_begin,
86 _S_token_interval_end,
93 _S_token_subexpr_begin,
101 _Scanner(_IteratorT __begin, _IteratorT __end, _FlagT __flags,
103 : _M_current(__begin) , _M_end(__end) , _M_flags(__flags),
104 _M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(_S_state_at_start)
112 { return _M_curToken; }
116 { return _M_curValue; }
118 #ifdef _GLIBCXX_DEBUG
120 _M_print(std::ostream&);
131 _M_scan_in_bracket();
143 _IteratorT _M_current;
148 _StringT _M_curValue;
152 template<typename _InputIterator>
154 _Scanner<_InputIterator>::
157 if (_M_current == _M_end)
159 _M_curToken = _S_token_eof;
163 _CharT __c = *_M_current;
164 if (_M_state & _S_state_in_bracket)
166 _M_scan_in_bracket();
169 if (_M_state & _S_state_in_brace)
174 else if (_M_state & _S_state_at_start && __c == _M_ctype.widen('^'))
176 _M_curToken = _S_token_line_begin;
180 else if (__c == _M_ctype.widen('$'))
182 _M_curToken = _S_token_line_end;
186 else if (__c == _M_ctype.widen('.'))
188 _M_curToken = _S_token_anychar;
192 else if (__c == _M_ctype.widen('*'))
194 _M_curToken = _S_token_closure0;
198 else if (__c == _M_ctype.widen('+'))
200 _M_curToken = _S_token_closure1;
204 else if (__c == _M_ctype.widen('|'))
206 _M_curToken = _S_token_or;
210 else if (__c == _M_ctype.widen('['))
212 _M_curToken = _S_token_bracket_begin;
213 _M_state |= (_S_state_in_bracket | _S_state_at_start);
217 else if (__c == _M_ctype.widen('\\'))
222 else if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
224 if (__c == _M_ctype.widen('('))
226 _M_curToken = _S_token_subexpr_begin;
230 else if (__c == _M_ctype.widen(')'))
232 _M_curToken = _S_token_subexpr_end;
236 else if (__c == _M_ctype.widen('{'))
238 _M_curToken = _S_token_interval_begin;
239 _M_state |= _S_state_in_brace;
245 _M_curToken = _S_token_ord_char;
246 _M_curValue.assign(1, __c);
251 template<typename _InputIterator>
253 _Scanner<_InputIterator>::
256 if (_M_ctype.is(_CtypeT::digit, *_M_current))
258 _M_curToken = _S_token_dup_count;
259 _M_curValue.assign(1, *_M_current);
261 while (_M_current != _M_end
262 && _M_ctype.is(_CtypeT::digit, *_M_current))
264 _M_curValue += *_M_current;
269 else if (*_M_current == _M_ctype.widen(','))
271 _M_curToken = _S_token_comma;
275 if (_M_flags & (regex_constants::basic | regex_constants::grep))
277 if (*_M_current == _M_ctype.widen('\\'))
282 if (*_M_current == _M_ctype.widen('}'))
284 _M_curToken = _S_token_interval_end;
285 _M_state &= ~_S_state_in_brace;
292 template<typename _InputIterator>
294 _Scanner<_InputIterator>::
297 if (_M_state & _S_state_at_start && *_M_current == _M_ctype.widen('^'))
299 _M_curToken = _S_token_inverse_class;
300 _M_state &= ~_S_state_at_start;
304 else if (*_M_current == _M_ctype.widen('['))
307 if (_M_current == _M_end)
309 _M_curToken = _S_token_eof;
313 if (*_M_current == _M_ctype.widen('.'))
315 _M_curToken = _S_token_collsymbol;
319 else if (*_M_current == _M_ctype.widen(':'))
321 _M_curToken = _S_token_char_class_name;
325 else if (*_M_current == _M_ctype.widen('='))
327 _M_curToken = _S_token_equiv_class_name;
332 else if (*_M_current == _M_ctype.widen('-'))
334 _M_curToken = _S_token_dash;
338 else if (*_M_current == _M_ctype.widen(']'))
340 if (!(_M_flags & regex_constants::ECMAScript)
341 || !(_M_state & _S_state_at_start))
343 // special case: only if _not_ chr first after
344 // '[' or '[^' and if not ECMAscript
345 _M_curToken = _S_token_bracket_end;
350 _M_curToken = _S_token_collelem_single;
351 _M_curValue.assign(1, *_M_current);
355 template<typename _InputIterator>
357 _Scanner<_InputIterator>::
361 if (_M_current == _M_end)
363 _M_curToken = _S_token_eof;
366 _CharT __c = *_M_current;
369 if (__c == _M_ctype.widen('('))
371 if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
373 _M_curToken = _S_token_ord_char;
374 _M_curValue.assign(1, __c);
377 _M_curToken = _S_token_subexpr_begin;
379 else if (__c == _M_ctype.widen(')'))
381 if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
383 _M_curToken = _S_token_ord_char;
384 _M_curValue.assign(1, __c);
387 _M_curToken = _S_token_subexpr_end;
389 else if (__c == _M_ctype.widen('{'))
391 if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
393 _M_curToken = _S_token_ord_char;
394 _M_curValue.assign(1, __c);
398 _M_curToken = _S_token_interval_begin;
399 _M_state |= _S_state_in_brace;
402 else if (__c == _M_ctype.widen('}'))
404 if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
406 _M_curToken = _S_token_ord_char;
407 _M_curValue.assign(1, __c);
411 if (!(_M_state && _S_state_in_brace))
412 __throw_regex_error(regex_constants::error_badbrace);
413 _M_state &= ~_S_state_in_brace;
414 _M_curToken = _S_token_interval_end;
417 else if (__c == _M_ctype.widen('x'))
420 if (_M_current == _M_end)
422 _M_curToken = _S_token_eof;
425 if (_M_ctype.is(_CtypeT::digit, *_M_current))
427 _M_curValue.assign(1, *_M_current);
429 if (_M_current == _M_end)
431 _M_curToken = _S_token_eof;
434 if (_M_ctype.is(_CtypeT::digit, *_M_current))
436 _M_curValue += *_M_current;
442 else if (__c == _M_ctype.widen('^')
443 || __c == _M_ctype.widen('.')
444 || __c == _M_ctype.widen('*')
445 || __c == _M_ctype.widen('$')
446 || __c == _M_ctype.widen('\\'))
448 _M_curToken = _S_token_ord_char;
449 _M_curValue.assign(1, __c);
451 else if (_M_ctype.is(_CtypeT::digit, __c))
453 _M_curToken = _S_token_backref;
454 _M_curValue.assign(1, __c);
457 __throw_regex_error(regex_constants::error_escape);
461 // Eats a character class or throwns an exception.
462 // current point to ':' delimiter on entry, char after ']' on return
463 template<typename _InputIterator>
465 _Scanner<_InputIterator>::
468 ++_M_current; // skip ':'
469 if (_M_current == _M_end)
470 __throw_regex_error(regex_constants::error_ctype);
471 for (_M_curValue.clear();
472 _M_current != _M_end && *_M_current != _M_ctype.widen(':');
474 _M_curValue += *_M_current;
475 if (_M_current == _M_end)
476 __throw_regex_error(regex_constants::error_ctype);
477 ++_M_current; // skip ':'
478 if (*_M_current != _M_ctype.widen(']'))
479 __throw_regex_error(regex_constants::error_ctype);
480 ++_M_current; // skip ']'
484 template<typename _InputIterator>
486 _Scanner<_InputIterator>::
489 ++_M_current; // skip '='
490 if (_M_current == _M_end)
491 __throw_regex_error(regex_constants::error_collate);
492 for (_M_curValue.clear();
493 _M_current != _M_end && *_M_current != _M_ctype.widen('=');
495 _M_curValue += *_M_current;
496 if (_M_current == _M_end)
497 __throw_regex_error(regex_constants::error_collate);
498 ++_M_current; // skip '='
499 if (*_M_current != _M_ctype.widen(']'))
500 __throw_regex_error(regex_constants::error_collate);
501 ++_M_current; // skip ']'
505 template<typename _InputIterator>
507 _Scanner<_InputIterator>::
510 ++_M_current; // skip '.'
511 if (_M_current == _M_end)
512 __throw_regex_error(regex_constants::error_collate);
513 for (_M_curValue.clear();
514 _M_current != _M_end && *_M_current != _M_ctype.widen('.');
516 _M_curValue += *_M_current;
517 if (_M_current == _M_end)
518 __throw_regex_error(regex_constants::error_collate);
519 ++_M_current; // skip '.'
520 if (*_M_current != _M_ctype.widen(']'))
521 __throw_regex_error(regex_constants::error_collate);
522 ++_M_current; // skip ']'
525 #ifdef _GLIBCXX_DEBUG
526 template<typename _InputIterator>
528 _Scanner<_InputIterator>::
529 _M_print(std::ostream& ostr)
533 case _S_token_anychar:
534 ostr << "any-character\n";
536 case _S_token_backref:
539 case _S_token_bracket_begin:
540 ostr << "bracket-begin\n";
542 case _S_token_bracket_end:
543 ostr << "bracket-end\n";
545 case _S_token_char_class_name:
546 ostr << "char-class-name \"" << _M_curValue << "\"\n";
548 case _S_token_closure0:
549 ostr << "closure0\n";
551 case _S_token_closure1:
552 ostr << "closure1\n";
554 case _S_token_collelem_multi:
555 ostr << "coll-elem-multi \"" << _M_curValue << "\"\n";
557 case _S_token_collelem_single:
558 ostr << "coll-elem-single \"" << _M_curValue << "\"\n";
560 case _S_token_collsymbol:
561 ostr << "collsymbol \"" << _M_curValue << "\"\n";
569 case _S_token_dup_count:
570 ostr << "dup count: " << _M_curValue << "\n";
575 case _S_token_equiv_class_name:
576 ostr << "equiv-class-name \"" << _M_curValue << "\"\n";
578 case _S_token_interval_begin:
579 ostr << "interval begin\n";
581 case _S_token_interval_end:
582 ostr << "interval end\n";
584 case _S_token_line_begin:
585 ostr << "line begin\n";
587 case _S_token_line_end:
588 ostr << "line end\n";
596 case _S_token_ord_char:
597 ostr << "ordinary character: \"" << _M_value() << "\"\n";
599 case _S_token_quoted_char:
600 ostr << "quoted char\n";
602 case _S_token_subexpr_begin:
603 ostr << "subexpr begin\n";
605 case _S_token_subexpr_end:
606 ostr << "subexpr end\n";
608 case _S_token_word_begin:
609 ostr << "word begin\n";
611 case _S_token_word_end:
612 ostr << "word end\n";
614 case _S_token_unknown:
615 ostr << "-- unknown token --\n";
622 // Builds an NFA from an input iterator interval.
623 template<typename _InIter, typename _TraitsT>
627 typedef _InIter _IterT;
628 typedef typename std::iterator_traits<_InIter>::value_type _CharT;
629 typedef std::basic_string<_CharT> _StringT;
630 typedef regex_constants::syntax_option_type _FlagT;
633 _Compiler(const _InIter& __b, const _InIter& __e,
634 _TraitsT& __traits, _FlagT __flags);
638 { return _M_state_store; }
641 typedef _Scanner<_InIter> _ScannerT;
642 typedef typename _ScannerT::_TokenT _TokenT;
643 typedef std::stack<_StateSeq, std::vector<_StateSeq> > _StackT;
644 typedef _RangeMatcher<_InIter, _TraitsT> _RMatcherT;
646 // accepts a specific token or returns false.
648 _M_match_token(_TokenT __token);
669 _M_bracket_expression();
672 _M_bracket_list(_RMatcherT& __matcher);
675 _M_follow_list(_RMatcherT& __matcher);
678 _M_follow_list2(_RMatcherT& __matcher);
681 _M_expression_term(_RMatcherT& __matcher);
684 _M_range_expression(_RMatcherT& __matcher);
687 _M_start_range(_RMatcherT& __matcher);
690 _M_collating_symbol(_RMatcherT& __matcher);
693 _M_equivalence_class(_RMatcherT& __matcher);
696 _M_character_class(_RMatcherT& __matcher);
699 _M_cur_int_value(int __radix);
703 _ScannerT _M_scanner;
704 _StringT _M_cur_value;
709 template<typename _InIter, typename _TraitsT>
710 _Compiler<_InIter, _TraitsT>::
711 _Compiler(const _InIter& __b, const _InIter& __e, _TraitsT& __traits,
712 _Compiler<_InIter, _TraitsT>::_FlagT __flags)
713 : _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()),
714 _M_state_store(__flags)
716 typedef _StartTagger<_InIter, _TraitsT> _Start;
717 typedef _EndTagger<_InIter, _TraitsT> _End;
719 _StateSeq __r(_M_state_store,
720 _M_state_store._M_insert_subexpr_begin(_Start(0)));
722 if (!_M_stack.empty())
724 __r._M_append(_M_stack.top());
727 __r._M_append(_M_state_store._M_insert_subexpr_end(0, _End(0)));
728 __r._M_append(_M_state_store._M_insert_accept());
731 template<typename _InIter, typename _TraitsT>
733 _Compiler<_InIter, _TraitsT>::
734 _M_match_token(_Compiler<_InIter, _TraitsT>::_TokenT token)
736 if (token == _M_scanner._M_token())
738 _M_cur_value = _M_scanner._M_value();
739 _M_scanner._M_advance();
745 template<typename _InIter, typename _TraitsT>
747 _Compiler<_InIter, _TraitsT>::
750 this->_M_alternative();
751 if (_M_match_token(_ScannerT::_S_token_or))
753 _StateSeq __alt1 = _M_stack.top(); _M_stack.pop();
754 this->_M_disjunction();
755 _StateSeq __alt2 = _M_stack.top(); _M_stack.pop();
756 _M_stack.push(_StateSeq(__alt1, __alt2));
760 template<typename _InIter, typename _TraitsT>
762 _Compiler<_InIter, _TraitsT>::
767 _StateSeq __re = _M_stack.top(); _M_stack.pop();
768 this->_M_alternative();
769 if (!_M_stack.empty())
771 __re._M_append(_M_stack.top());
780 template<typename _InIter, typename _TraitsT>
782 _Compiler<_InIter, _TraitsT>::
785 if (this->_M_assertion())
789 this->_M_quantifier();
795 template<typename _InIter, typename _TraitsT>
797 _Compiler<_InIter, _TraitsT>::
800 if (_M_match_token(_ScannerT::_S_token_line_begin))
802 // __m.push(_Matcher::_S_opcode_line_begin);
805 if (_M_match_token(_ScannerT::_S_token_line_end))
807 // __m.push(_Matcher::_S_opcode_line_end);
810 if (_M_match_token(_ScannerT::_S_token_word_begin))
812 // __m.push(_Matcher::_S_opcode_word_begin);
815 if (_M_match_token(_ScannerT::_S_token_word_end))
817 // __m.push(_Matcher::_S_opcode_word_end);
823 template<typename _InIter, typename _TraitsT>
825 _Compiler<_InIter, _TraitsT>::
828 if (_M_match_token(_ScannerT::_S_token_closure0))
830 if (_M_stack.empty())
831 __throw_regex_error(regex_constants::error_badrepeat);
832 _StateSeq __r(_M_stack.top(), -1);
833 __r._M_append(__r._M_front());
838 if (_M_match_token(_ScannerT::_S_token_closure1))
840 if (_M_stack.empty())
841 __throw_regex_error(regex_constants::error_badrepeat);
842 _StateSeq __r(_M_state_store,
844 _M_insert_alt(_S_invalid_state_id,
845 _M_stack.top()._M_front()));
846 _M_stack.top()._M_append(__r);
849 if (_M_match_token(_ScannerT::_S_token_opt))
851 if (_M_stack.empty())
852 __throw_regex_error(regex_constants::error_badrepeat);
853 _StateSeq __r(_M_stack.top(), -1);
858 if (_M_match_token(_ScannerT::_S_token_interval_begin))
860 if (_M_stack.empty())
861 __throw_regex_error(regex_constants::error_badrepeat);
862 if (!_M_match_token(_ScannerT::_S_token_dup_count))
863 __throw_regex_error(regex_constants::error_badbrace);
864 _StateSeq __r(_M_stack.top());
865 int __min_rep = _M_cur_int_value(10);
866 for (int __i = 1; __i < __min_rep; ++__i)
867 _M_stack.top()._M_append(__r._M_clone());
868 if (_M_match_token(_ScannerT::_S_token_comma))
869 if (_M_match_token(_ScannerT::_S_token_dup_count))
871 int __n = _M_cur_int_value(10) - __min_rep;
873 __throw_regex_error(regex_constants::error_badbrace);
874 for (int __i = 0; __i < __n; ++__i)
876 _StateSeq __r(_M_state_store,
878 _M_insert_alt(_S_invalid_state_id,
879 _M_stack.top()._M_front()));
880 _M_stack.top()._M_append(__r);
885 _StateSeq __r(_M_stack.top(), -1);
886 __r._M_push_back(__r._M_front());
890 if (!_M_match_token(_ScannerT::_S_token_interval_end))
891 __throw_regex_error(regex_constants::error_brace);
897 template<typename _InIter, typename _TraitsT>
899 _Compiler<_InIter, _TraitsT>::
902 typedef _CharMatcher<_InIter, _TraitsT> _CMatcher;
903 typedef _StartTagger<_InIter, _TraitsT> _Start;
904 typedef _EndTagger<_InIter, _TraitsT> _End;
906 if (_M_match_token(_ScannerT::_S_token_anychar))
908 _M_stack.push(_StateSeq(_M_state_store,
909 _M_state_store._M_insert_matcher
913 if (_M_match_token(_ScannerT::_S_token_ord_char))
915 _M_stack.push(_StateSeq(_M_state_store,
916 _M_state_store._M_insert_matcher
917 (_CMatcher(_M_cur_value[0], _M_traits))));
920 if (_M_match_token(_ScannerT::_S_token_quoted_char))
922 // note that in the ECMA grammar, this case covers backrefs.
923 _M_stack.push(_StateSeq(_M_state_store,
924 _M_state_store._M_insert_matcher
925 (_CMatcher(_M_cur_value[0], _M_traits))));
928 if (_M_match_token(_ScannerT::_S_token_backref))
930 // __m.push(_Matcher::_S_opcode_ordchar, _M_cur_value);
933 if (_M_match_token(_ScannerT::_S_token_subexpr_begin))
935 int __mark = _M_state_store._M_sub_count();
936 _StateSeq __r(_M_state_store,
938 _M_insert_subexpr_begin(_Start(__mark)));
939 this->_M_disjunction();
940 if (!_M_match_token(_ScannerT::_S_token_subexpr_end))
941 __throw_regex_error(regex_constants::error_paren);
942 if (!_M_stack.empty())
944 __r._M_append(_M_stack.top());
947 __r._M_append(_M_state_store._M_insert_subexpr_end
948 (__mark, _End(__mark)));
952 return _M_bracket_expression();
955 template<typename _InIter, typename _TraitsT>
957 _Compiler<_InIter, _TraitsT>::
958 _M_bracket_expression()
960 if (_M_match_token(_ScannerT::_S_token_bracket_begin))
962 _RMatcherT __matcher(_M_match_token(_ScannerT::_S_token_line_begin),
964 if (!_M_bracket_list(__matcher)
965 || !_M_match_token(_ScannerT::_S_token_bracket_end))
966 __throw_regex_error(regex_constants::error_brack);
967 _M_stack.push(_StateSeq(_M_state_store,
968 _M_state_store._M_insert_matcher(__matcher)));
974 // If the dash is the last character in the bracket expression, it is not
976 template<typename _InIter, typename _TraitsT>
978 _Compiler<_InIter, _TraitsT>::
979 _M_bracket_list(_RMatcherT& __matcher)
981 if (_M_follow_list(__matcher))
983 if (_M_match_token(_ScannerT::_S_token_dash))
984 __matcher._M_add_char(_M_cur_value[0]);
990 template<typename _InIter, typename _TraitsT>
992 _Compiler<_InIter, _TraitsT>::
993 _M_follow_list(_RMatcherT& __matcher)
994 { return _M_expression_term(__matcher) && _M_follow_list2(__matcher); }
996 template<typename _InIter, typename _TraitsT>
998 _Compiler<_InIter, _TraitsT>::
999 _M_follow_list2(_RMatcherT& __matcher)
1001 if (_M_expression_term(__matcher))
1002 return _M_follow_list2(__matcher);
1006 template<typename _InIter, typename _TraitsT>
1008 _Compiler<_InIter, _TraitsT>::
1009 _M_expression_term(_RMatcherT& __matcher)
1011 return (_M_collating_symbol(__matcher)
1012 || _M_character_class(__matcher)
1013 || _M_equivalence_class(__matcher)
1014 || (_M_start_range(__matcher)
1015 && _M_range_expression(__matcher)));
1018 template<typename _InIter, typename _TraitsT>
1020 _Compiler<_InIter, _TraitsT>::
1021 _M_range_expression(_RMatcherT& __matcher)
1023 if (!_M_collating_symbol(__matcher))
1024 if (!_M_match_token(_ScannerT::_S_token_dash))
1025 __throw_regex_error(regex_constants::error_range);
1026 __matcher._M_make_range();
1030 template<typename _InIter, typename _TraitsT>
1032 _Compiler<_InIter, _TraitsT>::
1033 _M_start_range(_RMatcherT& __matcher)
1034 { return _M_match_token(_ScannerT::_S_token_dash); }
1036 template<typename _InIter, typename _TraitsT>
1038 _Compiler<_InIter, _TraitsT>::
1039 _M_collating_symbol(_RMatcherT& __matcher)
1041 if (_M_match_token(_ScannerT::_S_token_collelem_single))
1043 __matcher._M_add_char(_M_cur_value[0]);
1046 if (_M_match_token(_ScannerT::_S_token_collsymbol))
1048 __matcher._M_add_collating_element(_M_cur_value);
1054 template<typename _InIter, typename _TraitsT>
1056 _Compiler<_InIter, _TraitsT>::
1057 _M_equivalence_class(_RMatcherT& __matcher)
1059 if (_M_match_token(_ScannerT::_S_token_equiv_class_name))
1061 __matcher._M_add_equivalence_class(_M_cur_value);
1067 template<typename _InIter, typename _TraitsT>
1069 _Compiler<_InIter, _TraitsT>::
1070 _M_character_class(_RMatcherT& __matcher)
1072 if (_M_match_token(_ScannerT::_S_token_char_class_name))
1074 __matcher._M_add_character_class(_M_cur_value);
1080 template<typename _InIter, typename _TraitsT>
1082 _Compiler<_InIter, _TraitsT>::
1083 _M_cur_int_value(int __radix)
1086 for (typename _StringT::size_type __i = 0;
1087 __i < _M_cur_value.length(); ++__i)
1088 __v =__v * __radix + _M_traits.value(_M_cur_value[__i], __radix);
1092 template<typename _InIter, typename _TraitsT>
1094 __compile(const _InIter& __b, const _InIter& __e, _TraitsT& __t,
1095 regex_constants::syntax_option_type __f)
1096 { return _AutomatonPtr(new _Nfa(_Compiler<_InIter, _TraitsT>(__b, __e, __t,
1099 } // namespace __regex
1101 _GLIBCXX_END_NAMESPACE_VERSION
1104 /* vim: set ts=8 sw=2 sts=2: */