Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52625 - in trunk/boost/spirit/home: karma/directive/detail karma/operator/detail karma/operator/karma-alt qi/string support/algorithm support/char_encoding
From: hartmut.kaiser_at_[hidden]
Date: 2009-04-27 08:29:35


Author: hkaiser
Date: 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
New Revision: 52625
URL: http://svn.boost.org/trac/boost/changeset/52625

Log:
Spirit: Added missing files, deleted old files, cleaned up empty directories
Added:
   trunk/boost/spirit/home/qi/string/lit.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/string/symbols.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/string/tst.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/string/tst_map.hpp (contents, props changed)
   trunk/boost/spirit/home/support/algorithm/any_if_ns.hpp (contents, props changed)
   trunk/boost/spirit/home/support/char_encoding/ascii.hpp (contents, props changed)
   trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp (contents, props changed)
   trunk/boost/spirit/home/support/char_encoding/standard.hpp (contents, props changed)
   trunk/boost/spirit/home/support/char_encoding/standard_wide.hpp (contents, props changed)
Removed:
   trunk/boost/spirit/home/karma/directive/detail/
   trunk/boost/spirit/home/karma/operator/detail/
   trunk/boost/spirit/home/karma/operator/karma-alt/

Added: trunk/boost/spirit/home/qi/string/lit.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/string/lit.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,231 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_LIT_APR_18_2006_1125PM)
+#define BOOST_SPIRIT_LIT_APR_18_2006_1125PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/detail/string_parse.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/value_at.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <string>
+
+namespace boost { namespace spirit
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // Enablers
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename T>
+ struct use_terminal<qi::domain, T
+ , typename enable_if<traits::is_string<T> >::type> // enables strings
+ : mpl::true_ {};
+
+ template <typename CharEncoding, typename A0>
+ struct use_terminal<qi::domain
+ , terminal_ex<
+ tag::char_code<tag::string, CharEncoding> // enables string(str)
+ , fusion::vector1<A0> >
+ > : traits::is_string<A0> {};
+
+ template <typename CharEncoding> // enables string(f)
+ struct use_lazy_terminal<
+ qi::domain
+ , tag::char_code<tag::string, CharEncoding>
+ , 1 /*arity*/
+ > : mpl::true_ {};
+
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+ using spirit::lit;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Parse for literal strings
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename String, bool no_attribute>
+ struct literal_string
+ : primitive_parser<literal_string<String, no_attribute> >
+ {
+ typedef typename
+ remove_const<typename traits::char_type_of<String>::type>::type
+ char_type;
+ typedef std::basic_string<char_type> string_type;
+
+ literal_string(typename add_reference<String>::type str)
+ : str(str)
+ {}
+
+ template <typename Context, typename Iterator>
+ struct attribute
+ {
+ typedef typename mpl::if_c<
+ no_attribute, unused_type, string_type>::type
+ type;
+ };
+
+ template <typename Iterator, typename Context
+ , typename Skipper, typename Attribute>
+ bool parse(Iterator& first, Iterator const& last
+ , Context& context, Skipper const& skipper, Attribute& attr) const
+ {
+ qi::skip_over(first, last, skipper);
+ return detail::string_parse(str, first, last, attr);
+ }
+
+ template <typename Context>
+ info what(Context& /*ctx*/) const
+ {
+ return info("literal-string", str);
+ }
+
+ String str;
+ };
+
+ template <typename String, bool no_attribute>
+ struct no_case_literal_string
+ : primitive_parser<no_case_literal_string<String, no_attribute> >
+ {
+ typedef typename
+ remove_const<typename traits::char_type_of<String>::type>::type
+ char_type;
+ typedef std::basic_string<char_type> string_type;
+
+ template <typename CharEncoding>
+ no_case_literal_string(char_type const* in, CharEncoding encoding)
+ : str_lo(in)
+ , str_hi(in)
+ {
+ typename string_type::iterator loi = str_lo.begin();
+ typename string_type::iterator hii = str_hi.begin();
+
+ for (; loi != str_lo.end(); ++loi, ++hii, ++in)
+ {
+ typedef typename CharEncoding::char_type encoded_char_type;
+
+ *loi = encoding.tolower(encoded_char_type(*loi));
+ *hii = encoding.toupper(encoded_char_type(*hii));
+ }
+ }
+
+ template <typename Context, typename Iterator>
+ struct attribute
+ {
+ typedef typename mpl::if_c<
+ no_attribute, unused_type, string_type>::type
+ type;
+ };
+
+ template <typename Iterator, typename Context
+ , typename Skipper, typename Attribute>
+ bool parse(Iterator& first, Iterator const& last
+ , Context& context, Skipper const& skipper, Attribute& attr) const
+ {
+ qi::skip_over(first, last, skipper);
+ return detail::string_parse(str_lo, str_hi, first, last, attr);
+ }
+
+ template <typename Context>
+ info what(Context& /*context*/) const
+ {
+ return info("no-case-literal-string", str_lo);
+ }
+
+ string_type str_lo, str_hi;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Parser generators: make_xxx function (objects)
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename T, typename Modifiers>
+ struct make_primitive<T, Modifiers
+ , typename enable_if<traits::is_string<T> >::type>
+ {
+ typedef has_modifier<Modifiers, tag::char_code_base<tag::no_case> > no_case;
+
+ typedef typename add_const<T>::type const_string;
+ typedef typename mpl::if_<
+ no_case
+ , no_case_literal_string<const_string, true>
+ , literal_string<const_string, true> >::type
+ result_type;
+
+ result_type operator()(
+ typename add_reference<const_string>::type str, unused_type) const
+ {
+ return op(str, no_case());
+ }
+
+ template <typename String>
+ result_type op(String const& str, mpl::false_) const
+ {
+ return result_type(str);
+ }
+
+ template <typename String>
+ result_type op(String const& str, mpl::true_) const
+ {
+ typename Modifiers::char_encoding encoding;
+ return result_type(traits::get_c_string(str), encoding);
+ }
+ };
+
+ template <typename Modifiers, typename CharEncoding, typename A0>
+ struct make_primitive<
+ terminal_ex<
+ tag::char_code<tag::string, CharEncoding>
+ , fusion::vector1<A0> >
+ , Modifiers>
+ {
+ typedef CharEncoding encoding;
+ typedef has_modifier<Modifiers, tag::char_code_base<tag::no_case> > no_case;
+
+ typedef typename add_const<A0>::type const_string;
+ typedef typename mpl::if_<
+ no_case
+ , no_case_literal_string<const_string, false>
+ , literal_string<const_string, false> >::type
+ result_type;
+
+ template <typename Terminal>
+ result_type operator()(Terminal const& term, unused_type) const
+ {
+ return op(fusion::at_c<0>(term.args), no_case());
+ }
+
+ template <typename String>
+ result_type op(String const& str, mpl::false_) const
+ {
+ return result_type(str);
+ }
+
+ template <typename String>
+ result_type op(String const& str, mpl::true_) const
+ {
+ return result_type(traits::get_c_string(str), encoding());
+ }
+ };
+
+}}}
+
+#endif

Added: trunk/boost/spirit/home/qi/string/symbols.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/string/symbols.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,330 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_SYMBOLS_MARCH_11_2007_1055AM)
+#define BOOST_SPIRIT_SYMBOLS_MARCH_11_2007_1055AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/string/tst.hpp>
+#include <boost/spirit/home/qi/reference.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+
+#include <boost/fusion/include/at.hpp>
+#include <boost/range.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable: 4355) // 'this' : used in base member initializer list warning
+#endif
+
+namespace boost { namespace spirit { namespace qi
+{
+ template <
+ typename Char = char
+ , typename T = unused_type
+ , typename Lookup = tst<Char, T>
+ , typename Filter = tst_pass_through>
+ struct symbols
+ : proto::extends<
+ typename proto::terminal<
+ reference<symbols<Char, T, Lookup, Filter> >
+ >::type
+ , symbols<Char, T, Lookup, Filter>
+ >
+ , parser<symbols<Char, T, Lookup, Filter> >
+ {
+ typedef Char char_type; // the character type
+ typedef T value_type; // the value associated with each entry
+ typedef symbols<Char, T, Lookup, Filter> this_type;
+ typedef reference<this_type> reference_;
+ typedef typename proto::terminal<reference_>::type terminal;
+ typedef proto::extends<terminal, this_type> base_type;
+
+ template <typename Context, typename Iterator>
+ struct attribute
+ {
+ typedef value_type type;
+ };
+
+ symbols()
+ : base_type(terminal::make(reference_(*this)))
+ , add(*this)
+ , remove(*this)
+ , lookup(new Lookup())
+ {
+ }
+
+ symbols(symbols const& syms)
+ : base_type(terminal::make(reference_(*this)))
+ , add(*this)
+ , remove(*this)
+ , lookup(syms.lookup)
+ {
+ }
+
+ template <typename Filter_>
+ symbols(symbols<Char, T, Lookup, Filter_> const& syms)
+ : base_type(terminal::make(reference_(*this)))
+ , add(*this)
+ , remove(*this)
+ , lookup(syms.lookup)
+ {
+ }
+
+ template <typename Symbols>
+ symbols(Symbols const& syms)
+ : base_type(terminal::make(reference_(*this)))
+ , add(*this)
+ , remove(*this)
+ , lookup(new Lookup())
+ {
+ typename range_const_iterator<Symbols>::type si = boost::begin(syms);
+ while (si != boost::end(syms))
+ add(*si++);
+ }
+
+ template <typename Symbols, typename Data>
+ symbols(Symbols const& syms, Data const& data)
+ : base_type(terminal::make(reference_(*this)))
+ , add(*this)
+ , remove(*this)
+ , lookup(new Lookup())
+ {
+ typename range_const_iterator<Symbols>::type si = boost::begin(syms);
+ typename range_const_iterator<Data>::type di = boost::begin(data);
+ while (si != boost::end(syms))
+ add(*si++, *di++);
+ }
+
+ symbols&
+ operator=(symbols const& rhs)
+ {
+ *lookup = *rhs.lookup;
+ return *this;
+ }
+
+ template <typename Filter_>
+ symbols&
+ operator=(symbols<Char, T, Lookup, Filter_> const& rhs)
+ {
+ *lookup = *rhs.lookup;
+ return *this;
+ }
+
+ void clear()
+ {
+ lookup->clear();
+ }
+
+ struct adder;
+ struct remover;
+
+ template <typename Str>
+ adder const&
+ operator=(Str const& str)
+ {
+ lookup->clear();
+ return add(str);
+ }
+
+ template <typename Str>
+ friend adder const&
+ operator+=(symbols& sym, Str const& str)
+ {
+ return sym.add(str);
+ }
+
+ template <typename Str>
+ friend remover const&
+ operator-=(symbols& sym, Str const& str)
+ {
+ return sym.remove(str);
+ }
+
+ // non-const version needed to suppress proto's += kicking in
+ template <typename Str>
+ friend adder const&
+ operator+=(symbols& sym, Str& str)
+ {
+ return sym.add(str);
+ }
+
+ // non-const version needed to suppress proto's -= kicking in
+ template <typename Str>
+ friend remover const&
+ operator-=(symbols& sym, Str& str)
+ {
+ return sym.remove(str);
+ }
+
+ template <typename F>
+ void for_each(F f) const
+ {
+ lookup->for_each(f);
+ }
+
+ template <typename Iterator, typename Context
+ , typename Skipper, typename Attribute>
+ bool parse(Iterator& first, Iterator const& last
+ , Context& context, Skipper const& skipper, Attribute& attr) const
+ {
+ qi::skip_over(first, last, skipper);
+
+ if (value_type* val_ptr
+ = lookup->find(first, last, Filter()))
+ {
+ detail::assign_to(*val_ptr, attr);
+ return true;
+ }
+ return false;
+ }
+
+ template <typename Context>
+ info what(Context& context) const
+ {
+ return info("symbols"); // $$$ for now! give symbols a name $$$
+ }
+
+ struct adder
+ {
+ template <typename, typename = unused_type, typename = unused_type>
+ struct result { typedef adder const& type; };
+
+ adder(symbols& sym)
+ : sym(sym)
+ {
+ }
+
+ template <typename Iterator>
+ adder const&
+ operator()(Iterator const& first, Iterator const& last, T const& val = T()) const
+ {
+ sym.lookup->add(first, last, val);
+ return *this;
+ }
+
+ template <typename Str>
+ adder const&
+ operator()(Str const& s, T const& val = T()) const
+ {
+ sym.lookup->add(traits::get_begin<Char>(s)
+ , traits::get_end<Char>(s), val);
+ return *this;
+ }
+
+ template <typename Str>
+ adder const&
+ operator,(Str const& s) const
+ {
+ sym.lookup->add(traits::get_begin<Char>(s)
+ , traits::get_end<Char>(s), T());
+ return *this;
+ }
+
+ symbols& sym;
+ };
+
+ struct remover
+ {
+ template <typename, typename = unused_type, typename = unused_type>
+ struct result { typedef remover const& type; };
+
+ remover(symbols& sym)
+ : sym(sym)
+ {
+ }
+
+ template <typename Iterator>
+ remover const&
+ operator()(Iterator const& first, Iterator const& last) const
+ {
+ sym.lookup->remove(first, last);
+ return *this;
+ }
+
+ template <typename Str>
+ remover const&
+ operator()(Str const& s) const
+ {
+ sym.lookup->remove(traits::get_begin<Char>(s)
+ , traits::get_end<Char>(s));
+ return *this;
+ }
+
+ template <typename Str>
+ remover const&
+ operator,(Str const& s) const
+ {
+ sym.lookup->remove(traits::get_begin<Char>(s)
+ , traits::get_end<Char>(s));
+ return *this;
+ }
+
+ symbols& sym;
+ };
+
+ adder add;
+ remover remove;
+ shared_ptr<Lookup> lookup;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Parser generators: make_xxx function (objects)
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Char, typename T, typename Lookup
+ , typename Filter, typename Modifiers>
+ struct make_primitive<reference<symbols<Char, T, Lookup, Filter> >, Modifiers>
+ {
+ template <typename CharEncoding>
+ struct no_case_filter
+ {
+ Char operator()(Char ch) const
+ {
+ return CharEncoding::tolower(ch);
+ }
+ };
+
+ typedef has_modifier<Modifiers, tag::char_code_base<tag::no_case> > no_case;
+ typedef reference<symbols<Char, T, Lookup, Filter> > reference_;
+ typedef no_case_filter<
+ typename spirit::detail::get_encoding<
+ Modifiers
+ , char_encoding::standard
+ , no_case::value>::type>
+ nc_filter;
+
+ typedef typename mpl::if_<
+ no_case
+ , symbols<Char, T, Lookup, nc_filter>
+ , reference_>::type
+ result_type;
+
+ result_type operator()(reference_ ref, unused_type) const
+ {
+ return result_type(ref.ref.get());
+ }
+ };
+}}}
+
+#if defined(BOOST_MSVC)
+# pragma warning(pop)
+#endif
+
+#endif

Added: trunk/boost/spirit/home/qi/string/tst.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/string/tst.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,137 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_TST_JUNE_03_2007_1031AM)
+#define BOOST_SPIRIT_TST_JUNE_03_2007_1031AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/string/detail/tst.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+ struct tst_pass_through
+ {
+ template <typename Char>
+ Char operator()(Char ch) const
+ {
+ return ch;
+ }
+ };
+
+ template <typename Char, typename T>
+ struct tst
+ {
+ typedef Char char_type; // the character type
+ typedef T value_type; // the value associated with each entry
+ typedef detail::tst_node<Char, T> node;
+
+ tst()
+ : root(0)
+ {
+ }
+
+ ~tst()
+ {
+ clear();
+ }
+
+ tst(tst const& rhs)
+ : root(0)
+ {
+ copy(rhs);
+ }
+
+ tst& operator=(tst const& rhs)
+ {
+ return assign(rhs);
+ }
+
+ template <typename Iterator, typename Filter>
+ T* find(Iterator& first, Iterator last, Filter filter) const
+ {
+ return node::find(root, first, last, filter);
+ }
+
+ template <typename Iterator>
+ T* find(Iterator& first, Iterator last) const
+ {
+ return find(first, last, tst_pass_through());
+ }
+
+ template <typename Iterator>
+ bool add(
+ Iterator first
+ , Iterator last
+ , typename boost::call_traits<T>::param_type val)
+ {
+ return node::add(root, first, last, val, this);
+ }
+
+ template <typename Iterator>
+ void remove(Iterator first, Iterator last)
+ {
+ node::remove(root, first, last, this);
+ }
+
+ void clear()
+ {
+ node::destruct_node(root, this);
+ root = 0;
+ }
+
+ template <typename F>
+ void for_each(F f) const
+ {
+ node::for_each(root, std::basic_string<Char>(), f);
+ }
+
+ private:
+
+ friend struct detail::tst_node<Char, T>;
+
+ void copy(tst const& rhs)
+ {
+ root = node::clone_node(rhs.root, this);
+ }
+
+ tst& assign(tst const& rhs)
+ {
+ if (this != &rhs)
+ {
+ clear();
+ copy(rhs);
+ }
+ return *this;
+ }
+
+ node* root;
+
+ node* new_node(Char id)
+ {
+ return new node(id);
+ }
+
+ T* new_data(typename boost::call_traits<T>::param_type val)
+ {
+ return new T(val);
+ }
+
+ void delete_node(node* p)
+ {
+ delete p;
+ }
+
+ void delete_data(T* p)
+ {
+ delete p;
+ }
+ };
+}}}
+
+#endif

Added: trunk/boost/spirit/home/qi/string/tst_map.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/string/tst_map.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,215 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_TST_MAP_JUNE_03_2007_1143AM)
+#define BOOST_SPIRIT_TST_MAP_JUNE_03_2007_1143AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/string/detail/tst.hpp>
+#include <boost/unordered_map.hpp>
+#include <boost/pool/object_pool.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+ struct tst_pass_through; // declared in tst.hpp
+
+ template <typename Char, typename T>
+ struct tst_map
+ {
+ typedef Char char_type; // the character type
+ typedef T value_type; // the value associated with each entry
+ typedef detail::tst_node<Char, T> node;
+
+ tst_map()
+ {
+ }
+
+ ~tst_map()
+ {
+ // Nothing to do here.
+ // The pools do the right thing for us
+ }
+
+ tst_map(tst_map const& rhs)
+ {
+ copy(rhs);
+ }
+
+ tst_map& operator=(tst_map const& rhs)
+ {
+ return assign(rhs);
+ }
+
+ template <typename Iterator, typename Filter>
+ T* find(Iterator& first, Iterator last, Filter filter) const
+ {
+ if (first != last)
+ {
+ Iterator save = first;
+ typename map_type::const_iterator
+ i = map.find(filter(*first++));
+ if (i == map.end())
+ {
+ first = save;
+ return 0;
+ }
+ if (T* p = node::find(i->second.root, first, last, filter))
+ {
+ return p;
+ }
+ return i->second.data;
+ }
+ return 0;
+ }
+
+ template <typename Iterator>
+ T* find(Iterator& first, Iterator last) const
+ {
+ return find(first, last, tst_pass_through());
+ }
+
+ template <typename Iterator>
+ bool add(
+ Iterator first
+ , Iterator last
+ , typename boost::call_traits<T>::param_type val)
+ {
+ if (first != last)
+ {
+ map_data x = {0, 0};
+ std::pair<typename map_type::iterator, bool>
+ r = map.insert(std::pair<Char, map_data>(*first++, x));
+
+ if (first != last)
+ {
+ return node::add(r.first->second.root, first, last, val, this);
+ }
+ else
+ {
+ if (r.first->second.data)
+ return false;
+ r.first->second.data = this->new_data(val);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ template <typename Iterator>
+ void remove(Iterator first, Iterator last)
+ {
+ if (first != last)
+ {
+ typename map_type::iterator i = map.find(*first++);
+ if (i != map.end())
+ {
+ if (first != last)
+ {
+ node::remove(i->second.root, first, last, this);
+ }
+ else if (i->second.data)
+ {
+ this->delete_data(i->second.data);
+ i->second.data = 0;
+ }
+ if (i->second.data == 0 && i->second.root == 0)
+ {
+ map.erase(i);
+ }
+ }
+ }
+ }
+
+ void clear()
+ {
+ BOOST_FOREACH(typename map_type::value_type& x, map)
+ {
+ node::destruct_node(x.second.root, this);
+ if (x.second.data)
+ this->delete_data(x.second.data);
+ }
+ map.clear();
+ }
+
+ template <typename F>
+ void for_each(F f) const
+ {
+ BOOST_FOREACH(typename map_type::value_type const& x, map)
+ {
+ std::basic_string<Char> s(1, x.first);
+ node::for_each(x.second.root, s, f);
+ if (x.second.data)
+ f(s, *x.second.data);
+ }
+ }
+
+ private:
+
+ friend struct detail::tst_node<Char, T>;
+
+ struct map_data
+ {
+ node* root;
+ T* data;
+ };
+
+ typedef unordered_map<Char, map_data> map_type;
+
+ void copy(tst_map const& rhs)
+ {
+ BOOST_FOREACH(typename map_type::value_type const& x, rhs.map)
+ {
+ map_data xx = {node::clone_node(x.second.root, this), 0};
+ if (x.second.data)
+ xx.data = data_pool.construct(*x.second.data);
+ map[x.first] = xx;
+ }
+ }
+
+ tst_map& assign(tst_map const& rhs)
+ {
+ if (this != &rhs)
+ {
+ BOOST_FOREACH(typename map_type::value_type& x, map)
+ {
+ node::destruct_node(x.second.root, this);
+ }
+ map.clear();
+ copy(rhs);
+ }
+ return *this;
+ }
+
+ node* new_node(Char id)
+ {
+ return node_pool.construct(id);
+ }
+
+ T* new_data(typename boost::call_traits<T>::param_type val)
+ {
+ return data_pool.construct(val);
+ }
+
+ void delete_node(node* p)
+ {
+ node_pool.destroy(p);
+ }
+
+ void delete_data(T* p)
+ {
+ data_pool.destroy(p);
+ }
+
+ map_type map;
+ object_pool<node> node_pool;
+ object_pool<T> data_pool;
+ };
+}}}
+
+#endif

Added: trunk/boost/spirit/home/support/algorithm/any_if_ns.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/algorithm/any_if_ns.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,91 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_ANY_IF_NS_NOVEMBER_04_2008_0906PM)
+#define BOOST_SPIRIT_ANY_IF_NS_NOVEMBER_04_2008_0906PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/algorithm/any_if.hpp>
+#include <boost/spirit/home/support/algorithm/any_ns.hpp>
+
+namespace boost { namespace spirit
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // This is a special version for a binary fusion::any. The predicate
+ // is used to decide whether to advance the second iterator or not.
+ // This is needed for sequences containing components with unused
+ // attributes. The second iterator is advanced only if the attribute
+ // of the corresponding component iterator is not unused.
+ //
+ // This is a non-short circuiting (ns) version of the any_if algorithm.
+ // see any_if.hpp (uses | instead of ||).
+ ///////////////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ template <
+ typename Pred, typename First1, typename Last, typename First2,
+ typename F
+ >
+ inline bool
+ any_if_ns(First1 const&, First2 const&, Last const&, F const&, mpl::true_)
+ {
+ return false;
+ }
+
+ template <
+ typename Pred, typename First1, typename Last, typename First2,
+ typename F
+ >
+ inline bool
+ any_if_ns(First1 const& first1, First2 const& first2, Last const& last,
+ F& f, mpl::false_)
+ {
+ return (0 != (f(*first1, attribute_value<Pred, First1>(first2)) |
+ detail::any_if_ns<Pred>(
+ fusion::next(first1)
+ , attribute_next<Pred, First1>(first2)
+ , last
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::next<First1>::type, Last>())));
+ }
+ }
+
+ template <typename Pred, typename Sequence1, typename Sequence2, typename F>
+ inline bool
+ any_if_ns(Sequence1 const& seq1, Sequence2& seq2, F f, Pred)
+ {
+ return detail::any_if_ns<Pred>(
+ fusion::begin(seq1)
+ , fusion::begin(seq2)
+ , fusion::end(seq1)
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::begin<Sequence1>::type
+ , typename fusion::result_of::end<Sequence1>::type>());
+ }
+
+ template <typename Pred, typename Sequence, typename F>
+ inline bool
+ any_if_ns(Sequence const& seq, unused_type const, F f, Pred)
+ {
+ return detail::any_ns(
+ fusion::begin(seq)
+ , fusion::end(seq)
+ , f
+ , fusion::result_of::equal_to<
+ typename fusion::result_of::begin<Sequence>::type
+ , typename fusion::result_of::end<Sequence>::type>());
+ }
+
+}}
+
+#endif
+

Added: trunk/boost/spirit/home/support/char_encoding/ascii.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/char_encoding/ascii.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,313 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_ASCII_APRIL_26_2006_1106PM)
+#define BOOST_SPIRIT_ASCII_APRIL_26_2006_1106PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <climits>
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// constants used to classify the single characters
+///////////////////////////////////////////////////////////////////////////////
+#define BOOST_CC_DIGIT 0x0001
+#define BOOST_CC_XDIGIT 0x0002
+#define BOOST_CC_ALPHA 0x0004
+#define BOOST_CC_CTRL 0x0008
+#define BOOST_CC_LOWER 0x0010
+#define BOOST_CC_UPPER 0x0020
+#define BOOST_CC_SPACE 0x0040
+#define BOOST_CC_PUNCT 0x0080
+
+namespace boost { namespace spirit { namespace char_encoding
+{
+ // The detection of isgraph(), isprint() and isblank() is done programmatically
+ // to keep the character type table small. Additionally, these functions are
+ // rather seldom used and the programmatic detection is very simple.
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ASCII character classification table
+ ///////////////////////////////////////////////////////////////////////////
+ const unsigned char ascii_char_types[] =
+ {
+ /* NUL 0 0 */ BOOST_CC_CTRL,
+ /* SOH 1 1 */ BOOST_CC_CTRL,
+ /* STX 2 2 */ BOOST_CC_CTRL,
+ /* ETX 3 3 */ BOOST_CC_CTRL,
+ /* EOT 4 4 */ BOOST_CC_CTRL,
+ /* ENQ 5 5 */ BOOST_CC_CTRL,
+ /* ACK 6 6 */ BOOST_CC_CTRL,
+ /* BEL 7 7 */ BOOST_CC_CTRL,
+ /* BS 8 8 */ BOOST_CC_CTRL,
+ /* HT 9 9 */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* NL 10 a */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* VT 11 b */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* NP 12 c */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* CR 13 d */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* SO 14 e */ BOOST_CC_CTRL,
+ /* SI 15 f */ BOOST_CC_CTRL,
+ /* DLE 16 10 */ BOOST_CC_CTRL,
+ /* DC1 17 11 */ BOOST_CC_CTRL,
+ /* DC2 18 12 */ BOOST_CC_CTRL,
+ /* DC3 19 13 */ BOOST_CC_CTRL,
+ /* DC4 20 14 */ BOOST_CC_CTRL,
+ /* NAK 21 15 */ BOOST_CC_CTRL,
+ /* SYN 22 16 */ BOOST_CC_CTRL,
+ /* ETB 23 17 */ BOOST_CC_CTRL,
+ /* CAN 24 18 */ BOOST_CC_CTRL,
+ /* EM 25 19 */ BOOST_CC_CTRL,
+ /* SUB 26 1a */ BOOST_CC_CTRL,
+ /* ESC 27 1b */ BOOST_CC_CTRL,
+ /* FS 28 1c */ BOOST_CC_CTRL,
+ /* GS 29 1d */ BOOST_CC_CTRL,
+ /* RS 30 1e */ BOOST_CC_CTRL,
+ /* US 31 1f */ BOOST_CC_CTRL,
+ /* SP 32 20 */ BOOST_CC_SPACE,
+ /* ! 33 21 */ BOOST_CC_PUNCT,
+ /* " 34 22 */ BOOST_CC_PUNCT,
+ /* # 35 23 */ BOOST_CC_PUNCT,
+ /* $ 36 24 */ BOOST_CC_PUNCT,
+ /* % 37 25 */ BOOST_CC_PUNCT,
+ /* & 38 26 */ BOOST_CC_PUNCT,
+ /* ' 39 27 */ BOOST_CC_PUNCT,
+ /* ( 40 28 */ BOOST_CC_PUNCT,
+ /* ) 41 29 */ BOOST_CC_PUNCT,
+ /* * 42 2a */ BOOST_CC_PUNCT,
+ /* + 43 2b */ BOOST_CC_PUNCT,
+ /* , 44 2c */ BOOST_CC_PUNCT,
+ /* - 45 2d */ BOOST_CC_PUNCT,
+ /* . 46 2e */ BOOST_CC_PUNCT,
+ /* / 47 2f */ BOOST_CC_PUNCT,
+ /* 0 48 30 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 1 49 31 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 2 50 32 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 3 51 33 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 4 52 34 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 5 53 35 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 6 54 36 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 7 55 37 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 8 56 38 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 9 57 39 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* : 58 3a */ BOOST_CC_PUNCT,
+ /* ; 59 3b */ BOOST_CC_PUNCT,
+ /* < 60 3c */ BOOST_CC_PUNCT,
+ /* = 61 3d */ BOOST_CC_PUNCT,
+ /* > 62 3e */ BOOST_CC_PUNCT,
+ /* ? 63 3f */ BOOST_CC_PUNCT,
+ /* @ 64 40 */ BOOST_CC_PUNCT,
+ /* A 65 41 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* B 66 42 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* C 67 43 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* D 68 44 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* E 69 45 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* F 70 46 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* G 71 47 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* H 72 48 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* I 73 49 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* J 74 4a */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* K 75 4b */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* L 76 4c */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* M 77 4d */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* N 78 4e */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* O 79 4f */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* P 80 50 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Q 81 51 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* R 82 52 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* S 83 53 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* T 84 54 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* U 85 55 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* V 86 56 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* W 87 57 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* X 88 58 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Y 89 59 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Z 90 5a */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* [ 91 5b */ BOOST_CC_PUNCT,
+ /* \ 92 5c */ BOOST_CC_PUNCT,
+ /* ] 93 5d */ BOOST_CC_PUNCT,
+ /* ^ 94 5e */ BOOST_CC_PUNCT,
+ /* _ 95 5f */ BOOST_CC_PUNCT,
+ /* ` 96 60 */ BOOST_CC_PUNCT,
+ /* a 97 61 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* b 98 62 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* c 99 63 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* d 100 64 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* e 101 65 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* f 102 66 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* g 103 67 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* h 104 68 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* i 105 69 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* j 106 6a */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* k 107 6b */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* l 108 6c */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* m 109 6d */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* n 110 6e */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* o 111 6f */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* p 112 70 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* q 113 71 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* r 114 72 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* s 115 73 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* t 116 74 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* u 117 75 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* v 118 76 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* w 119 77 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* x 120 78 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* y 121 79 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* z 122 7a */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* { 123 7b */ BOOST_CC_PUNCT,
+ /* | 124 7c */ BOOST_CC_PUNCT,
+ /* } 125 7d */ BOOST_CC_PUNCT,
+ /* ~ 126 7e */ BOOST_CC_PUNCT,
+ /* DEL 127 7f */ BOOST_CC_CTRL,
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Test characters for specified conditions (using ASCII)
+ ///////////////////////////////////////////////////////////////////////////
+ struct ascii
+ {
+ typedef char char_type;
+
+ static bool
+ isascii_(int ch)
+ {
+ return (0 == (ch & ~0x7f)) ? true : false;
+ }
+
+ static bool
+ ischar(int ch)
+ {
+ return isascii_(ch);
+ }
+
+ static int
+ isalnum(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_ALPHA)
+ || (ascii_char_types[ch] & BOOST_CC_DIGIT);
+ }
+
+ static int
+ isalpha(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_ALPHA);
+ }
+
+ static int
+ isdigit(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_DIGIT);
+ }
+
+ static int
+ isxdigit(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_XDIGIT);
+ }
+
+ static int
+ iscntrl(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_CTRL);
+ }
+
+ static int
+ isgraph(int ch)
+ {
+ return ('\x21' <= ch && ch <= '\x7e');
+ }
+
+ static int
+ islower(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_LOWER);
+ }
+
+ static int
+ isprint(int ch)
+ {
+ return ('\x20' <= ch && ch <= '\x7e');
+ }
+
+ static int
+ ispunct(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_PUNCT);
+ }
+
+ static int
+ isspace(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_SPACE);
+ }
+
+ static int
+ isblank BOOST_PREVENT_MACRO_SUBSTITUTION (int ch)
+ {
+ return ('\x09' == ch || '\x20' == ch);
+ }
+
+ static int
+ isupper(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return (ascii_char_types[ch] & BOOST_CC_UPPER);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Simple character conversions
+ ///////////////////////////////////////////////////////////////////////
+
+ static int
+ tolower(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return isupper(ch) ? (ch - 'A' + 'a') : ch;
+ }
+
+ static int
+ toupper(int ch)
+ {
+ BOOST_ASSERT(isascii_(ch));
+ return islower(ch) ? (ch - 'a' + 'A') : ch;
+ }
+
+ static ::boost::uint32_t
+ toucs4(int ch)
+ {
+ return ch;
+ }
+ };
+
+}}}
+
+///////////////////////////////////////////////////////////////////////////////
+// undefine macros
+///////////////////////////////////////////////////////////////////////////////
+#undef BOOST_CC_DIGIT
+#undef BOOST_CC_XDIGIT
+#undef BOOST_CC_ALPHA
+#undef BOOST_CC_CTRL
+#undef BOOST_CC_LOWER
+#undef BOOST_CC_UPPER
+#undef BOOST_CC_PUNCT
+#undef BOOST_CC_SPACE
+
+#endif
+

Added: trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,709 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_ISO8859_1_APRIL_26_2006_1106PM)
+#define BOOST_SPIRIT_ISO8859_1_APRIL_26_2006_1106PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <climits>
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// constants used to classify the single characters
+///////////////////////////////////////////////////////////////////////////////
+#define BOOST_CC_DIGIT 0x0001
+#define BOOST_CC_XDIGIT 0x0002
+#define BOOST_CC_ALPHA 0x0004
+#define BOOST_CC_CTRL 0x0008
+#define BOOST_CC_LOWER 0x0010
+#define BOOST_CC_UPPER 0x0020
+#define BOOST_CC_SPACE 0x0040
+#define BOOST_CC_PUNCT 0x0080
+
+namespace boost { namespace spirit { namespace char_encoding
+{
+ // The detection of isgraph(), isprint() and isblank() is done programmatically
+ // to keep the character type table small. Additionally, these functions are
+ // rather seldom used and the programmatic detection is very simple.
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ISO 8859-1 character classification table
+ //
+ // the comments intentionally contain non-ascii characters
+ // boostinspect:noascii
+ ///////////////////////////////////////////////////////////////////////////
+ const unsigned char iso8859_1_char_types[] =
+ {
+ /* NUL 0 0 */ BOOST_CC_CTRL,
+ /* SOH 1 1 */ BOOST_CC_CTRL,
+ /* STX 2 2 */ BOOST_CC_CTRL,
+ /* ETX 3 3 */ BOOST_CC_CTRL,
+ /* EOT 4 4 */ BOOST_CC_CTRL,
+ /* ENQ 5 5 */ BOOST_CC_CTRL,
+ /* ACK 6 6 */ BOOST_CC_CTRL,
+ /* BEL 7 7 */ BOOST_CC_CTRL,
+ /* BS 8 8 */ BOOST_CC_CTRL,
+ /* HT 9 9 */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* NL 10 a */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* VT 11 b */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* NP 12 c */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* CR 13 d */ BOOST_CC_CTRL|BOOST_CC_SPACE,
+ /* SO 14 e */ BOOST_CC_CTRL,
+ /* SI 15 f */ BOOST_CC_CTRL,
+ /* DLE 16 10 */ BOOST_CC_CTRL,
+ /* DC1 17 11 */ BOOST_CC_CTRL,
+ /* DC2 18 12 */ BOOST_CC_CTRL,
+ /* DC3 19 13 */ BOOST_CC_CTRL,
+ /* DC4 20 14 */ BOOST_CC_CTRL,
+ /* NAK 21 15 */ BOOST_CC_CTRL,
+ /* SYN 22 16 */ BOOST_CC_CTRL,
+ /* ETB 23 17 */ BOOST_CC_CTRL,
+ /* CAN 24 18 */ BOOST_CC_CTRL,
+ /* EM 25 19 */ BOOST_CC_CTRL,
+ /* SUB 26 1a */ BOOST_CC_CTRL,
+ /* ESC 27 1b */ BOOST_CC_CTRL,
+ /* FS 28 1c */ BOOST_CC_CTRL,
+ /* GS 29 1d */ BOOST_CC_CTRL,
+ /* RS 30 1e */ BOOST_CC_CTRL,
+ /* US 31 1f */ BOOST_CC_CTRL,
+ /* SP 32 20 */ BOOST_CC_SPACE,
+ /* ! 33 21 */ BOOST_CC_PUNCT,
+ /* " 34 22 */ BOOST_CC_PUNCT,
+ /* # 35 23 */ BOOST_CC_PUNCT,
+ /* $ 36 24 */ BOOST_CC_PUNCT,
+ /* % 37 25 */ BOOST_CC_PUNCT,
+ /* & 38 26 */ BOOST_CC_PUNCT,
+ /* ' 39 27 */ BOOST_CC_PUNCT,
+ /* ( 40 28 */ BOOST_CC_PUNCT,
+ /* ) 41 29 */ BOOST_CC_PUNCT,
+ /* * 42 2a */ BOOST_CC_PUNCT,
+ /* + 43 2b */ BOOST_CC_PUNCT,
+ /* , 44 2c */ BOOST_CC_PUNCT,
+ /* - 45 2d */ BOOST_CC_PUNCT,
+ /* . 46 2e */ BOOST_CC_PUNCT,
+ /* / 47 2f */ BOOST_CC_PUNCT,
+ /* 0 48 30 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 1 49 31 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 2 50 32 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 3 51 33 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 4 52 34 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 5 53 35 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 6 54 36 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 7 55 37 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 8 56 38 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* 9 57 39 */ BOOST_CC_DIGIT|BOOST_CC_XDIGIT,
+ /* : 58 3a */ BOOST_CC_PUNCT,
+ /* ; 59 3b */ BOOST_CC_PUNCT,
+ /* < 60 3c */ BOOST_CC_PUNCT,
+ /* = 61 3d */ BOOST_CC_PUNCT,
+ /* > 62 3e */ BOOST_CC_PUNCT,
+ /* ? 63 3f */ BOOST_CC_PUNCT,
+ /* @ 64 40 */ BOOST_CC_PUNCT,
+ /* A 65 41 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* B 66 42 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* C 67 43 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* D 68 44 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* E 69 45 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* F 70 46 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_UPPER,
+ /* G 71 47 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* H 72 48 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* I 73 49 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* J 74 4a */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* K 75 4b */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* L 76 4c */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* M 77 4d */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* N 78 4e */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* O 79 4f */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* P 80 50 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Q 81 51 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* R 82 52 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* S 83 53 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* T 84 54 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* U 85 55 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* V 86 56 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* W 87 57 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* X 88 58 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Y 89 59 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Z 90 5a */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* [ 91 5b */ BOOST_CC_PUNCT,
+ /* \ 92 5c */ BOOST_CC_PUNCT,
+ /* ] 93 5d */ BOOST_CC_PUNCT,
+ /* ^ 94 5e */ BOOST_CC_PUNCT,
+ /* _ 95 5f */ BOOST_CC_PUNCT,
+ /* ` 96 60 */ BOOST_CC_PUNCT,
+ /* a 97 61 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* b 98 62 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* c 99 63 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* d 100 64 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* e 101 65 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* f 102 66 */ BOOST_CC_ALPHA|BOOST_CC_XDIGIT|BOOST_CC_LOWER,
+ /* g 103 67 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* h 104 68 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* i 105 69 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* j 106 6a */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* k 107 6b */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* l 108 6c */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* m 109 6d */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* n 110 6e */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* o 111 6f */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* p 112 70 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* q 113 71 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* r 114 72 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* s 115 73 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* t 116 74 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* u 117 75 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* v 118 76 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* w 119 77 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* x 120 78 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* y 121 79 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* z 122 7a */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* { 123 7b */ BOOST_CC_PUNCT,
+ /* | 124 7c */ BOOST_CC_PUNCT,
+ /* } 125 7d */ BOOST_CC_PUNCT,
+ /* ~ 126 7e */ BOOST_CC_PUNCT,
+ /* DEL 127 7f */ BOOST_CC_CTRL,
+ /* -- 128 80 */ BOOST_CC_CTRL,
+ /* -- 129 81 */ BOOST_CC_CTRL,
+ /* -- 130 82 */ BOOST_CC_CTRL,
+ /* -- 131 83 */ BOOST_CC_CTRL,
+ /* -- 132 84 */ BOOST_CC_CTRL,
+ /* -- 133 85 */ BOOST_CC_CTRL,
+ /* -- 134 86 */ BOOST_CC_CTRL,
+ /* -- 135 87 */ BOOST_CC_CTRL,
+ /* -- 136 88 */ BOOST_CC_CTRL,
+ /* -- 137 89 */ BOOST_CC_CTRL,
+ /* -- 138 8a */ BOOST_CC_CTRL,
+ /* -- 139 8b */ BOOST_CC_CTRL,
+ /* -- 140 8c */ BOOST_CC_CTRL,
+ /* -- 141 8d */ BOOST_CC_CTRL,
+ /* -- 142 8e */ BOOST_CC_CTRL,
+ /* -- 143 8f */ BOOST_CC_CTRL,
+ /* -- 144 90 */ BOOST_CC_CTRL,
+ /* -- 145 91 */ BOOST_CC_CTRL,
+ /* -- 146 92 */ BOOST_CC_CTRL,
+ /* -- 147 93 */ BOOST_CC_CTRL,
+ /* -- 148 94 */ BOOST_CC_CTRL,
+ /* -- 149 95 */ BOOST_CC_CTRL,
+ /* -- 150 96 */ BOOST_CC_CTRL,
+ /* -- 151 97 */ BOOST_CC_CTRL,
+ /* -- 152 98 */ BOOST_CC_CTRL,
+ /* -- 153 99 */ BOOST_CC_CTRL,
+ /* -- 154 9a */ BOOST_CC_CTRL,
+ /* -- 155 9b */ BOOST_CC_CTRL,
+ /* -- 156 9c */ BOOST_CC_CTRL,
+ /* -- 157 9d */ BOOST_CC_CTRL,
+ /* -- 158 9e */ BOOST_CC_CTRL,
+ /* -- 159 9f */ BOOST_CC_CTRL,
+ /* 160 a0 */ BOOST_CC_SPACE,
+ /* ¡ 161 a1 */ BOOST_CC_PUNCT,
+ /* ¢ 162 a2 */ BOOST_CC_PUNCT,
+ /* £ 163 a3 */ BOOST_CC_PUNCT,
+ /* ¤ 164 a4 */ BOOST_CC_PUNCT,
+ /* ¥ 165 a5 */ BOOST_CC_PUNCT,
+ /* ¦ 166 a6 */ BOOST_CC_PUNCT,
+ /* § 167 a7 */ BOOST_CC_PUNCT,
+ /* ¨ 168 a8 */ BOOST_CC_PUNCT,
+ /* © 169 a9 */ BOOST_CC_PUNCT,
+ /* ª 170 aa */ BOOST_CC_PUNCT,
+ /* « 171 ab */ BOOST_CC_PUNCT,
+ /* ¬ 172 ac */ BOOST_CC_PUNCT,
+ /* ­ 173 ad */ BOOST_CC_PUNCT,
+ /* ® 174 ae */ BOOST_CC_PUNCT,
+ /* ¯ 175 af */ BOOST_CC_PUNCT,
+ /* ° 176 b0 */ BOOST_CC_PUNCT,
+ /* ± 177 b1 */ BOOST_CC_PUNCT,
+ /* ² 178 b2 */ BOOST_CC_DIGIT|BOOST_CC_PUNCT,
+ /* ³ 179 b3 */ BOOST_CC_DIGIT|BOOST_CC_PUNCT,
+ /* ´ 180 b4 */ BOOST_CC_PUNCT,
+ /* µ 181 b5 */ BOOST_CC_PUNCT,
+ /* ¶ 182 b6 */ BOOST_CC_PUNCT,
+ /* · 183 b7 */ BOOST_CC_PUNCT,
+ /* ¸ 184 b8 */ BOOST_CC_PUNCT,
+ /* ¹ 185 b9 */ BOOST_CC_DIGIT|BOOST_CC_PUNCT,
+ /* º 186 ba */ BOOST_CC_PUNCT,
+ /* » 187 bb */ BOOST_CC_PUNCT,
+ /* ¼ 188 bc */ BOOST_CC_PUNCT,
+ /* ½ 189 bd */ BOOST_CC_PUNCT,
+ /* ¾ 190 be */ BOOST_CC_PUNCT,
+ /* ¿ 191 bf */ BOOST_CC_PUNCT,
+ /* À 192 c0 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Á 193 c1 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Â 194 c2 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ã 195 c3 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ä 196 c4 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Å 197 c5 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Æ 198 c6 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ç 199 c7 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* È 200 c8 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* É 201 c9 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ê 202 ca */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ë 203 cb */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ì 204 cc */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Í 205 cd */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Î 206 ce */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ï 207 cf */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ð 208 d0 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ñ 209 d1 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ò 210 d2 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ó 211 d3 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ô 212 d4 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Õ 213 d5 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ö 214 d6 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* × 215 d7 */ BOOST_CC_PUNCT,
+ /* Ø 216 d8 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ù 217 d9 */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ú 218 da */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Û 219 db */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ü 220 dc */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Ý 221 dd */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* Þ 222 de */ BOOST_CC_ALPHA|BOOST_CC_UPPER,
+ /* ß 223 df */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* à 224 e0 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* á 225 e1 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* â 226 e2 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ã 227 e3 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ä 228 e4 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* å 229 e5 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* æ 230 e6 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ç 231 e7 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* è 232 e8 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* é 233 e9 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ê 234 ea */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ë 235 eb */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ì 236 ec */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* í 237 ed */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* î 238 ee */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ï 239 ef */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ð 240 f0 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ñ 241 f1 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ò 242 f2 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ó 243 f3 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ô 244 f4 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* õ 245 f5 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ö 246 f6 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ÷ 247 f7 */ BOOST_CC_PUNCT,
+ /* ø 248 f8 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ù 249 f9 */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ú 250 fa */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* û 251 fb */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ü 252 fc */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ý 253 fd */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* þ 254 fe */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ /* ÿ 255 ff */ BOOST_CC_ALPHA|BOOST_CC_LOWER,
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ISO 8859-1 character conversion table
+ ///////////////////////////////////////////////////////////////////////////
+ const unsigned char iso8859_1_char_conversion[] =
+ {
+ /* NUL 0 0 */ '\0',
+ /* SOH 1 1 */ '\0',
+ /* STX 2 2 */ '\0',
+ /* ETX 3 3 */ '\0',
+ /* EOT 4 4 */ '\0',
+ /* ENQ 5 5 */ '\0',
+ /* ACK 6 6 */ '\0',
+ /* BEL 7 7 */ '\0',
+ /* BS 8 8 */ '\0',
+ /* HT 9 9 */ '\0',
+ /* NL 10 a */ '\0',
+ /* VT 11 b */ '\0',
+ /* NP 12 c */ '\0',
+ /* CR 13 d */ '\0',
+ /* SO 14 e */ '\0',
+ /* SI 15 f */ '\0',
+ /* DLE 16 10 */ '\0',
+ /* DC1 17 11 */ '\0',
+ /* DC2 18 12 */ '\0',
+ /* DC3 19 13 */ '\0',
+ /* DC4 20 14 */ '\0',
+ /* NAK 21 15 */ '\0',
+ /* SYN 22 16 */ '\0',
+ /* ETB 23 17 */ '\0',
+ /* CAN 24 18 */ '\0',
+ /* EM 25 19 */ '\0',
+ /* SUB 26 1a */ '\0',
+ /* ESC 27 1b */ '\0',
+ /* FS 28 1c */ '\0',
+ /* GS 29 1d */ '\0',
+ /* RS 30 1e */ '\0',
+ /* US 31 1f */ '\0',
+ /* SP 32 20 */ '\0',
+ /* ! 33 21 */ '\0',
+ /* " 34 22 */ '\0',
+ /* # 35 23 */ '\0',
+ /* $ 36 24 */ '\0',
+ /* % 37 25 */ '\0',
+ /* & 38 26 */ '\0',
+ /* ' 39 27 */ '\0',
+ /* ( 40 28 */ '\0',
+ /* ) 41 29 */ '\0',
+ /* * 42 2a */ '\0',
+ /* + 43 2b */ '\0',
+ /* , 44 2c */ '\0',
+ /* - 45 2d */ '\0',
+ /* . 46 2e */ '\0',
+ /* / 47 2f */ '\0',
+ /* 0 48 30 */ '\0',
+ /* 1 49 31 */ '\0',
+ /* 2 50 32 */ '\0',
+ /* 3 51 33 */ '\0',
+ /* 4 52 34 */ '\0',
+ /* 5 53 35 */ '\0',
+ /* 6 54 36 */ '\0',
+ /* 7 55 37 */ '\0',
+ /* 8 56 38 */ '\0',
+ /* 9 57 39 */ '\0',
+ /* : 58 3a */ '\0',
+ /* ; 59 3b */ '\0',
+ /* < 60 3c */ '\0',
+ /* = 61 3d */ '\0',
+ /* > 62 3e */ '\0',
+ /* ? 63 3f */ '\0',
+ /* @ 64 40 */ '\0',
+ /* A 65 41 */ 'a',
+ /* B 66 42 */ 'b',
+ /* C 67 43 */ 'c',
+ /* D 68 44 */ 'd',
+ /* E 69 45 */ 'e',
+ /* F 70 46 */ 'f',
+ /* G 71 47 */ 'g',
+ /* H 72 48 */ 'h',
+ /* I 73 49 */ 'i',
+ /* J 74 4a */ 'j',
+ /* K 75 4b */ 'k',
+ /* L 76 4c */ 'l',
+ /* M 77 4d */ 'm',
+ /* N 78 4e */ 'n',
+ /* O 79 4f */ 'o',
+ /* P 80 50 */ 'p',
+ /* Q 81 51 */ 'q',
+ /* R 82 52 */ 'r',
+ /* S 83 53 */ 's',
+ /* T 84 54 */ 't',
+ /* U 85 55 */ 'u',
+ /* V 86 56 */ 'v',
+ /* W 87 57 */ 'w',
+ /* X 88 58 */ 'x',
+ /* Y 89 59 */ 'y',
+ /* Z 90 5a */ 'z',
+ /* [ 91 5b */ '\0',
+ /* \ 92 5c */ '\0',
+ /* ] 93 5d */ '\0',
+ /* ^ 94 5e */ '\0',
+ /* _ 95 5f */ '\0',
+ /* ` 96 60 */ '\0',
+ /* a 97 61 */ 'A',
+ /* b 98 62 */ 'B',
+ /* c 99 63 */ 'C',
+ /* d 100 64 */ 'D',
+ /* e 101 65 */ 'E',
+ /* f 102 66 */ 'F',
+ /* g 103 67 */ 'G',
+ /* h 104 68 */ 'H',
+ /* i 105 69 */ 'I',
+ /* j 106 6a */ 'J',
+ /* k 107 6b */ 'K',
+ /* l 108 6c */ 'L',
+ /* m 109 6d */ 'M',
+ /* n 110 6e */ 'N',
+ /* o 111 6f */ 'O',
+ /* p 112 70 */ 'P',
+ /* q 113 71 */ 'Q',
+ /* r 114 72 */ 'R',
+ /* s 115 73 */ 'S',
+ /* t 116 74 */ 'T',
+ /* u 117 75 */ 'U',
+ /* v 118 76 */ 'V',
+ /* w 119 77 */ 'W',
+ /* x 120 78 */ 'X',
+ /* y 121 79 */ 'Y',
+ /* z 122 7a */ 'Z',
+ /* { 123 7b */ '\0',
+ /* | 124 7c */ '\0',
+ /* } 125 7d */ '\0',
+ /* ~ 126 7e */ '\0',
+ /* DEL 127 7f */ '\0',
+ /* -- 128 80 */ '\0',
+ /* -- 129 81 */ '\0',
+ /* -- 130 82 */ '\0',
+ /* -- 131 83 */ '\0',
+ /* -- 132 84 */ '\0',
+ /* -- 133 85 */ '\0',
+ /* -- 134 86 */ '\0',
+ /* -- 135 87 */ '\0',
+ /* -- 136 88 */ '\0',
+ /* -- 137 89 */ '\0',
+ /* -- 138 8a */ '\0',
+ /* -- 139 8b */ '\0',
+ /* -- 140 8c */ '\0',
+ /* -- 141 8d */ '\0',
+ /* -- 142 8e */ '\0',
+ /* -- 143 8f */ '\0',
+ /* -- 144 90 */ '\0',
+ /* -- 145 91 */ '\0',
+ /* -- 146 92 */ '\0',
+ /* -- 147 93 */ '\0',
+ /* -- 148 94 */ '\0',
+ /* -- 149 95 */ '\0',
+ /* -- 150 96 */ '\0',
+ /* -- 151 97 */ '\0',
+ /* -- 152 98 */ '\0',
+ /* -- 153 99 */ '\0',
+ /* -- 154 9a */ '\0',
+ /* -- 155 9b */ '\0',
+ /* -- 156 9c */ '\0',
+ /* -- 157 9d */ '\0',
+ /* -- 158 9e */ '\0',
+ /* -- 159 9f */ '\0',
+ /* 160 a0 */ '\0',
+ /* ¡ 161 a1 */ '\0',
+ /* ¢ 162 a2 */ '\0',
+ /* £ 163 a3 */ '\0',
+ /* ¤ 164 a4 */ '\0',
+ /* ¥ 165 a5 */ '\0',
+ /* ¦ 166 a6 */ '\0',
+ /* § 167 a7 */ '\0',
+ /* ¨ 168 a8 */ '\0',
+ /* © 169 a9 */ '\0',
+ /* ª 170 aa */ '\0',
+ /* « 171 ab */ '\0',
+ /* ¬ 172 ac */ '\0',
+ /* ­ 173 ad */ '\0',
+ /* ® 174 ae */ '\0',
+ /* ¯ 175 af */ '\0',
+ /* ° 176 b0 */ '\0',
+ /* ± 177 b1 */ '\0',
+ /* ² 178 b2 */ '\0',
+ /* ³ 179 b3 */ '\0',
+ /* ´ 180 b4 */ '\0',
+ /* µ 181 b5 */ '\0',
+ /* ¶ 182 b6 */ '\0',
+ /* · 183 b7 */ '\0',
+ /* ¸ 184 b8 */ '\0',
+ /* ¹ 185 b9 */ '\0',
+ /* º 186 ba */ '\0',
+ /* » 187 bb */ '\0',
+ /* ¼ 188 bc */ '\0',
+ /* ½ 189 bd */ '\0',
+ /* ¾ 190 be */ '\0',
+ /* ¿ 191 bf */ '\0',
+ /* à 192 c0 */ 0xe0,
+ /* á 193 c1 */ 0xe1,
+ /* â 194 c2 */ 0xe2,
+ /* ã 195 c3 */ 0xe3,
+ /* ä 196 c4 */ 0xe4,
+ /* å 197 c5 */ 0xe5,
+ /* æ 198 c6 */ 0xe6,
+ /* ç 199 c7 */ 0xe7,
+ /* è 200 c8 */ 0xe8,
+ /* é 201 c9 */ 0xe9,
+ /* ê 202 ca */ 0xea,
+ /* ë 203 cb */ 0xeb,
+ /* ì 204 cc */ 0xec,
+ /* í 205 cd */ 0xed,
+ /* î 206 ce */ 0xee,
+ /* ï 207 cf */ 0xef,
+ /* ð 208 d0 */ 0xf0,
+ /* ñ 209 d1 */ 0xf1,
+ /* ò 210 d2 */ 0xf2,
+ /* ó 211 d3 */ 0xf3,
+ /* ô 212 d4 */ 0xf4,
+ /* õ 213 d5 */ 0xf5,
+ /* ö 214 d6 */ 0xf6,
+ /* × 215 d7 */ '\0',
+ /* ø 216 d8 */ 0xf8,
+ /* ù 217 d9 */ 0xf9,
+ /* ú 218 da */ 0xfa,
+ /* û 219 db */ 0xfb,
+ /* ü 220 dc */ 0xfc,
+ /* ý 221 dd */ 0xfd,
+ /* þ 222 de */ 0xfe,
+ /* ß 223 df */ '\0',
+ /* À 224 e0 */ 0xc0,
+ /* Á 225 e1 */ 0xc1,
+ /* Â 226 e2 */ 0xc2,
+ /* Ã 227 e3 */ 0xc3,
+ /* Ä 228 e4 */ 0xc4,
+ /* Å 229 e5 */ 0xc5,
+ /* Æ 230 e6 */ 0xc6,
+ /* Ç 231 e7 */ 0xc7,
+ /* È 232 e8 */ 0xc8,
+ /* É 233 e9 */ 0xc9,
+ /* Ê 234 ea */ 0xca,
+ /* Ë 235 eb */ 0xcb,
+ /* Ì 236 ec */ 0xcc,
+ /* Í 237 ed */ 0xcd,
+ /* Î 238 ee */ 0xce,
+ /* Ï 239 ef */ 0xcf,
+ /* Ð 240 f0 */ 0xd0,
+ /* Ñ 241 f1 */ 0xd1,
+ /* Ò 242 f2 */ 0xd2,
+ /* Ó 243 f3 */ 0xd3,
+ /* Ô 244 f4 */ 0xd4,
+ /* Õ 245 f5 */ 0xd5,
+ /* Ö 246 f6 */ 0xd6,
+ /* ÷ 247 f7 */ '\0',
+ /* Ø 248 f8 */ 0xd8,
+ /* Ù 249 f9 */ 0xd9,
+ /* Ú 250 fa */ 0xda,
+ /* Û 251 fb */ 0xdb,
+ /* Ü 252 fc */ 0xdc,
+ /* Ý 253 fd */ 0xdd,
+ /* Þ 254 fe */ 0xde,
+ /* ÿ 255 ff */ '\0',
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Test characters for specified conditions (using iso8859-1)
+ ///////////////////////////////////////////////////////////////////////////
+ struct iso8859_1
+ {
+ typedef unsigned char char_type;
+
+ static bool
+ isascii_(int ch)
+ {
+ return (0 == (ch & ~0x7f)) ? true : false;
+ }
+
+ static bool
+ ischar(int ch)
+ {
+ return true; // iso8859.1 uses all 8 bits
+ }
+
+ static int
+ isalnum(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_ALPHA)
+ || (iso8859_1_char_types[ch] & BOOST_CC_DIGIT);
+ }
+
+ static int
+ isalpha(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_ALPHA);
+ }
+
+ static int
+ isdigit(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_DIGIT);
+ }
+
+ static int
+ isxdigit(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_XDIGIT);
+ }
+
+ static int
+ iscntrl(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_CTRL);
+ }
+
+ static int
+ isgraph(int ch)
+ {
+ return ('\x21' <= ch && ch <= '\x7e') || ('\xa1' <= ch && ch <= '\xff');
+ }
+
+ static int
+ islower(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_LOWER);
+ }
+
+ static int
+ isprint(int ch)
+ {
+ return ('\x20' <= ch && ch <= '\x7e') || ('\xa0' <= ch && ch <= '\xff');
+ }
+
+ static int
+ ispunct(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_PUNCT);
+ }
+
+ static int
+ isspace(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_SPACE);
+ }
+
+ static int
+ isblank BOOST_PREVENT_MACRO_SUBSTITUTION (int ch)
+ {
+ return ('\x09' == ch || '\x20' == ch || '\xa0' == ch);
+ }
+
+ static int
+ isupper(int ch)
+ {
+ BOOST_ASSERT(0 == (ch & ~UCHAR_MAX));
+ return (iso8859_1_char_types[ch] & BOOST_CC_UPPER);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Simple character conversions
+ ///////////////////////////////////////////////////////////////////////////
+
+ static int
+ tolower(int ch)
+ {
+ return isupper(ch) && '\0' != iso8859_1_char_conversion[ch] ?
+ iso8859_1_char_conversion[ch] : ch;
+ }
+
+ static int
+ toupper(int ch)
+ {
+ return islower(ch) && '\0' != iso8859_1_char_conversion[ch] ?
+ iso8859_1_char_conversion[ch] : ch;
+ }
+
+ static ::boost::uint32_t
+ toucs4(int ch)
+ {
+ // The first 256 characters in Unicode and the UCS are
+ // identical to those in ISO/IEC-8859-1.
+ return ch;
+ }
+ };
+
+}}}
+
+///////////////////////////////////////////////////////////////////////////////
+// undefine macros
+///////////////////////////////////////////////////////////////////////////////
+#undef BOOST_CC_DIGIT
+#undef BOOST_CC_XDIGIT
+#undef BOOST_CC_ALPHA
+#undef BOOST_CC_CTRL
+#undef BOOST_CC_LOWER
+#undef BOOST_CC_UPPER
+#undef BOOST_CC_PUNCT
+#undef BOOST_CC_SPACE
+
+#endif
+

Added: trunk/boost/spirit/home/support/char_encoding/standard.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/char_encoding/standard.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,135 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_STANDARD_APRIL_26_2006_1106PM)
+#define BOOST_SPIRIT_STANDARD_APRIL_26_2006_1106PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <cctype>
+#include <boost/cstdint.hpp>
+
+namespace boost { namespace spirit { namespace char_encoding
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // Test characters for specified conditions (using std functions)
+ ///////////////////////////////////////////////////////////////////////////
+ struct standard
+ {
+ typedef char char_type;
+
+ static bool
+ isascii_(int ch)
+ {
+ return (0 == (ch & ~0x7f)) ? true : false;
+ }
+
+ static bool
+ ischar(int ch)
+ {
+ return true; // use all the bits
+ }
+
+ static int
+ isalnum(int ch)
+ {
+ return std::isalnum(ch);
+ }
+
+ static int
+ isalpha(int ch)
+ {
+ return std::isalpha(ch);
+ }
+
+ static int
+ isdigit(int ch)
+ {
+ return std::isdigit(ch);
+ }
+
+ static int
+ isxdigit(int ch)
+ {
+ return std::isxdigit(ch);
+ }
+
+ static int
+ iscntrl(int ch)
+ {
+ return std::iscntrl(ch);
+ }
+
+ static int
+ isgraph(int ch)
+ {
+ return std::isgraph(ch);
+ }
+
+ static int
+ islower(int ch)
+ {
+ return std::islower(ch);
+ }
+
+ static int
+ isprint(int ch)
+ {
+ return std::isprint(ch);
+ }
+
+ static int
+ ispunct(int ch)
+ {
+ return std::ispunct(ch);
+ }
+
+ static int
+ isspace(int ch)
+ {
+ return std::isspace(ch);
+ }
+
+ static int
+ isblank BOOST_PREVENT_MACRO_SUBSTITUTION (int ch)
+ {
+ return (ch == ' ' || ch == '\t');
+ }
+
+ static int
+ isupper(int ch)
+ {
+ return std::isupper(ch);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Simple character conversions
+ ///////////////////////////////////////////////////////////////////////////////
+ static int
+ tolower(int ch)
+ {
+ return std::tolower(ch);
+ }
+
+ static int
+ toupper(int ch)
+ {
+ return std::toupper(ch);
+ }
+
+ static ::boost::uint32_t
+ toucs4(int ch)
+ {
+ return ch;
+ }
+ };
+}}}
+
+#endif
+

Added: trunk/boost/spirit/home/support/char_encoding/standard_wide.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/char_encoding/standard_wide.hpp 2009-04-27 08:29:34 EDT (Mon, 27 Apr 2009)
@@ -0,0 +1,155 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_STANDARD_WIDE_NOVEMBER_10_2006_0913AM)
+#define BOOST_SPIRIT_STANDARD_WIDE_NOVEMBER_10_2006_0913AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <cwctype>
+#include <boost/cstdint.hpp>
+
+namespace boost { namespace spirit { namespace char_encoding
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // Test characters for specified conditions (using std wchar_t functions)
+ ///////////////////////////////////////////////////////////////////////////
+ struct standard_wide
+ {
+ typedef wchar_t char_type;
+
+ template <typename Char>
+ static typename std::char_traits<Char>::int_type
+ to_int_type(Char ch)
+ {
+ return std::char_traits<Char>::to_int_type(ch);
+ }
+
+ template <typename Char>
+ static Char
+ to_char_type(typename std::char_traits<Char>::int_type ch)
+ {
+ return std::char_traits<Char>::to_char_type(ch);
+ }
+
+ static bool
+ ischar(wchar_t ch)
+ {
+ return true; // any wchar_t
+ }
+
+ static bool
+ isalnum(wchar_t ch)
+ {
+ using namespace std;
+ return iswalnum(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isalpha(wchar_t ch)
+ {
+ using namespace std;
+ return iswalpha(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ iscntrl(wchar_t ch)
+ {
+ using namespace std;
+ return iswcntrl(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isdigit(wchar_t ch)
+ {
+ using namespace std;
+ return iswdigit(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isgraph(wchar_t ch)
+ {
+ using namespace std;
+ return iswgraph(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ islower(wchar_t ch)
+ {
+ using namespace std;
+ return iswlower(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isprint(wchar_t ch)
+ {
+ using namespace std;
+ return iswprint(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ ispunct(wchar_t ch)
+ {
+ using namespace std;
+ return iswpunct(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isspace(wchar_t ch)
+ {
+ using namespace std;
+ return iswspace(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isupper(wchar_t ch)
+ {
+ using namespace std;
+ return iswupper(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isxdigit(wchar_t ch)
+ {
+ using namespace std;
+ return iswxdigit(to_int_type(ch)) ? true : false;
+ }
+
+ static bool
+ isblank BOOST_PREVENT_MACRO_SUBSTITUTION (wchar_t ch)
+ {
+ return (ch == L' ' || ch == L'\t');
+ }
+
+ static wchar_t
+ tolower(wchar_t ch)
+ {
+ using namespace std;
+ return isupper(ch) ?
+ to_char_type<wchar_t>(towlower(to_int_type(ch))) : ch;
+ }
+
+ static wchar_t
+ toupper(wchar_t ch)
+ {
+ using namespace std;
+ return islower(ch) ?
+ to_char_type<wchar_t>(towupper(to_int_type(ch))) : ch;
+ }
+
+ static ::boost::uint32_t
+ toucs4(int ch)
+ {
+ return ch;
+ }
+ };
+}}}
+
+#endif
+


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