|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49742 - trunk/boost/spirit/home/support/detail/lexer/parser/tokeniser
From: jamin.hanson_at_[hidden]
Date: 2008-11-14 10:05:25
Author: ben_hanson
Date: 2008-11-14 10:05:24 EST (Fri, 14 Nov 2008)
New Revision: 49742
URL: http://svn.boost.org/trac/boost/changeset/49742
Log:
flag shenanigans.
Text files modified:
trunk/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
Modified: trunk/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp (original)
+++ trunk/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp 2008-11-14 10:05:24 EST (Fri, 14 Nov 2008)
@@ -1,13 +1,15 @@
// tokeniser_state.hpp
-// Copyright (c) 2007 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_LEXER_RE_TOKENISER_STATE_HPP
#define BOOST_LEXER_RE_TOKENISER_STATE_HPP
+#include "../../consts.hpp"
#include <locale>
#include "../../size_t.hpp"
+#include <stack>
namespace boost
{
@@ -18,26 +20,24 @@
template<typename CharT>
struct basic_re_tokeniser_state
{
- const CharT *_curr;
+ const CharT * const _start;
const CharT * const _end;
- bool _case_sensitive;
+ const CharT *_curr;
+ regex_flags _flags;
+ std::stack<regex_flags> _flags_stack;
std::locale _locale;
- bool _dot_not_newline;
- std::size_t _index;
long _paren_count;
bool _in_string;
bool _seen_BOL_assertion;
bool _seen_EOL_assertion;
- basic_re_tokeniser_state (const CharT *regex_, const CharT * const end_,
- const bool case_sensitive_, const std::locale locale_,
- const bool dot_not_newline_) :
- _curr (regex_),
+ basic_re_tokeniser_state (const CharT *start_, const CharT * const end_,
+ const regex_flags flags_, const std::locale locale_) :
+ _start (start_),
_end (end_),
- _case_sensitive (case_sensitive_),
+ _curr (start_),
+ _flags (flags_),
_locale (locale_),
- _dot_not_newline (dot_not_newline_),
- _index (0),
_paren_count (0),
_in_string (false),
_seen_BOL_assertion (false),
@@ -48,12 +48,11 @@
// prevent VC++ 7.1 warning:
const basic_re_tokeniser_state &operator = (const basic_re_tokeniser_state &rhs_)
{
- _curr = rhs_._curr;
+ _start = rhs_._start;
_end = rhs_._end;
- _case_sensitive = rhs_._case_sensitive;
+ _curr = rhs_._curr;
+ _flags = rhs_._flags;
_locale = rhs_._locale;
- _dot_not_newline = rhs_._dot_not_newline;
- _index = rhs_._index;
_paren_count = rhs_._paren_count;
_in_string = rhs_._in_string;
_seen_BOL_assertion = rhs_._seen_BOL_assertion;
@@ -79,7 +78,11 @@
inline void increment ()
{
++_curr;
- ++_index;
+ }
+
+ inline std::size_t index ()
+ {
+ return _curr - _start;
}
inline bool eos ()
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk