update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -14,7 +14,7 @@
#include <limits> // std::numeric_limits
#include <climits> // CHAR_BIT
#include <boost/wave/wave_config.hpp>
#include <boost/wave/wave_config.hpp>
#include <boost/static_assert.hpp>
#include <boost/cstdint.hpp>
@@ -30,7 +30,7 @@
#include <boost/spirit/include/phoenix1_statements.hpp>
#include <boost/spirit/include/phoenix1_functions.hpp>
#include <boost/wave/cpp_exceptions.hpp>
#include <boost/wave/cpp_exceptions.hpp>
#include <boost/wave/grammars/cpp_literal_grammar_gen.hpp>
#if !defined(spirit_append_actor)
@@ -45,17 +45,17 @@
///////////////////////////////////////////////////////////////////////////////
//
// Reusable grammar to parse a C++ style character literal
// Reusable grammar to parse a C++ style character literal
//
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace grammars {
namespace closures {
struct chlit_closure
: boost::spirit::classic::closure<chlit_closure, boost::uint32_t, bool>
struct chlit_closure
: boost::spirit::classic::closure<chlit_closure, boost::uint32_t, bool>
{
member1 value;
member2 long_lit;
@@ -72,35 +72,35 @@ namespace impl {
struct compose_character_literal {
template <typename A1, typename A2, typename A3, typename A4>
struct result
{
typedef void type;
struct result
{
typedef void type;
};
void
void
operator()(boost::uint32_t& value, bool long_lit, bool& overflow,
boost::uint32_t character) const
{
{
// The following assumes that wchar_t is max. 32 Bit
BOOST_STATIC_ASSERT(sizeof(wchar_t) <= 4);
static boost::uint32_t masks[] = {
static boost::uint32_t masks[] = {
0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff
};
static boost::uint32_t overflow_masks[] = {
static boost::uint32_t overflow_masks[] = {
0xff000000, 0xffff0000, 0xffffff00, 0xffffffff
};
if (long_lit) {
// make sure no overflow will occur below
if ((value & overflow_masks[sizeof(wchar_t)-1]) != 0) {
overflow |= true;
}
else {
// calculate the new value (avoiding a warning regarding
// calculate the new value (avoiding a warning regarding
// shifting count >= size of the type)
value <<= CHAR_BIT * (sizeof(wchar_t)-1);
value <<= CHAR_BIT;
value <<= CHAR_BIT;
value |= character & masks[sizeof(wchar_t)-1];
}
}
@@ -128,25 +128,25 @@ namespace impl {
/**/
struct chlit_grammar :
public boost::spirit::classic::grammar<chlit_grammar,
public boost::spirit::classic::grammar<chlit_grammar,
closures::chlit_closure::context_t>
{
chlit_grammar()
: overflow(false)
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "chlit_grammar",
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "chlit_grammar",
TRACE_CHLIT_GRAMMAR);
}
// no need for copy constructor/assignment operator
chlit_grammar(chlit_grammar const&);
chlit_grammar& operator=(chlit_grammar const&);
template <typename ScannerT>
struct definition
{
typedef boost::spirit::classic::rule<
ScannerT, closures::chlit_closure::context_t>
ScannerT, closures::chlit_closure::context_t>
rule_t;
rule_t ch_lit;
@@ -155,7 +155,7 @@ struct chlit_grammar :
{
using namespace boost::spirit::classic;
namespace phx = phoenix;
// special parsers for '\x..' and L'\x....'
typedef uint_parser<
unsigned int, 16, 1, 2 * sizeof(char)
@@ -170,68 +170,68 @@ struct chlit_grammar :
>> !ch_p('L')[self.long_lit = phx::val(true)]
>> ch_p('\'')
>> +( (
ch_p('\\')
ch_p('\\')
>> ( ch_p('a') // BEL
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x07))
]
| ch_p('b') // BS
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x08))
]
| ch_p('t') // HT
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x09))
]
| ch_p('n') // NL
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x0a))
]
| ch_p('v') // VT
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x0b))
]
| ch_p('f') // FF
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x0c))
]
| ch_p('r') // CR
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val(0x0d))
]
| ch_p('?')
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val('?'))
]
| ch_p('\'')
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val('\''))
]
| ch_p('\"')
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val('\"'))
]
| ch_p('\\')
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::val('\\'))
]
| ch_p('x')
>> if_p(self.long_lit)
| ch_p('x')
>> if_p(self.long_lit)
[
hex_wchar_parser_type()
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::arg1)
]
]
@@ -239,32 +239,32 @@ struct chlit_grammar :
[
hex_char_parser_type()
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::arg1)
]
]
| ch_p('u')
| ch_p('u')
>> uint_parser<unsigned int, 16, 4, 4>()
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::arg1)
]
| ch_p('U')
>> uint_parser<unsigned int, 16, 8, 8>()
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::arg1)
]
| uint_parser<unsigned int, 8, 1, 3>()
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::arg1)
]
)
)
| ~eps_p(ch_p('\'')) >> anychar_p
[
impl::compose(self.value, self.long_lit,
impl::compose(self.value, self.long_lit,
phx::var(self.overflow), phx::arg1)
]
)
@@ -286,25 +286,25 @@ struct chlit_grammar :
#undef TRACE_CHLIT_GRAMMAR
///////////////////////////////////////////////////////////////////////////////
//
// The following function is defined here, to allow the separation of
//
// The following function is defined here, to allow the separation of
// the compilation of the intlit_grammap from the function using it.
//
//
///////////////////////////////////////////////////////////////////////////////
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_CHLITGRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_CHLITGRAMMAR_GEN_INLINE inline
#endif
#endif
template <typename IntegralResult, typename TokenT>
BOOST_WAVE_CHLITGRAMMAR_GEN_INLINE
BOOST_WAVE_CHLITGRAMMAR_GEN_INLINE
IntegralResult
chlit_grammar_gen<IntegralResult, TokenT>::evaluate(TokenT const &token, value_error &status)
{
using namespace boost::spirit::classic;
chlit_grammar g;
IntegralResult result = 0;
typename TokenT::string_type const &token_val = token.get_value();
@@ -312,15 +312,15 @@ parse_info<typename TokenT::string_type::const_iterator> hit =
parse(token_val.begin(), token_val.end(), g[spirit_assign_actor(result)]);
if (!hit.hit) {
BOOST_WAVE_THROW(preprocess_exception, ill_formed_character_literal,
BOOST_WAVE_THROW(preprocess_exception, ill_formed_character_literal,
token_val.c_str(), token.get_position());
}
else {
// range check
if ('L' == token_val[0]) {
// recognized wide character
if (g.overflow ||
result > (IntegralResult)(std::numeric_limits<wchar_t>::max)())
if (g.overflow ||
result > (IntegralResult)(std::numeric_limits<wchar_t>::max)())
{
// out of range
status = error_character_overflow;
@@ -328,8 +328,8 @@ parse_info<typename TokenT::string_type::const_iterator> hit =
}
else {
// recognized narrow ('normal') character
if (g.overflow ||
result > (IntegralResult)(std::numeric_limits<unsigned char>::max)())
if (g.overflow ||
result > (IntegralResult)(std::numeric_limits<unsigned char>::max)())
{
// out of range
status = error_character_overflow;

View File

@@ -35,7 +35,7 @@
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace grammars {
///////////////////////////////////////////////////////////////////////////////
@@ -51,7 +51,7 @@ struct defined_grammar :
defined_grammar(ContainerT &result_seq_)
: result_seq(result_seq_)
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "defined_grammar",
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "defined_grammar",
TRACE_CPP_DEFINED_GRAMMAR);
}
@@ -84,20 +84,20 @@ struct defined_grammar :
= ch_p(T_IDENTIFIER)
[
spirit_append_actor(self.result_seq)
]
]
| pattern_p(KeywordTokenType, TokenTypeMask|PPTokenFlag)
[
spirit_append_actor(self.result_seq)
]
| pattern_p(OperatorTokenType|AltExtTokenType,
]
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag)
[
spirit_append_actor(self.result_seq)
]
]
| pattern_p(BoolLiteralTokenType, TokenTypeMask|PPTokenFlag)
[
spirit_append_actor(self.result_seq)
]
]
;
BOOST_SPIRIT_DEBUG_TRACE_RULE(defined_op, TRACE_CPP_DEFINED_GRAMMAR);
@@ -116,28 +116,28 @@ struct defined_grammar :
#undef TRACE_CPP_DEFINED_GRAMMAR
///////////////////////////////////////////////////////////////////////////////
//
// The following parse function is defined here, to allow the separation of
// the compilation of the defined_grammar from the function
//
// The following parse function is defined here, to allow the separation of
// the compilation of the defined_grammar from the function
// using it.
//
//
///////////////////////////////////////////////////////////////////////////////
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE inline
#endif
#endif
// The parse_operator_define function is instantiated manually twice to
// simplify the explicit specialization of this template. This way the user
// The parse_operator_define function is instantiated manually twice to
// simplify the explicit specialization of this template. This way the user
// has only to specify one template parameter (the lexer type) to correctly
// formulate the required explicit specialization.
// This results in no code overhead, because otherwise the function would be
// generated by the compiler twice anyway.
template <typename LexIteratorT>
BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
boost::spirit::classic::parse_info<
typename defined_grammar_gen<LexIteratorT>::iterator1_type
>
@@ -147,14 +147,14 @@ defined_grammar_gen<LexIteratorT>::parse_operator_defined (
{
using namespace boost::spirit::classic;
using namespace boost::wave;
defined_grammar<token_sequence_type> g(found_qualified_name);
return boost::spirit::classic::parse (
first, last, g, ch_p(T_SPACE) | ch_p(T_CCOMMENT));
}
template <typename LexIteratorT>
BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
boost::spirit::classic::parse_info<
typename defined_grammar_gen<LexIteratorT>::iterator2_type
>
@@ -164,7 +164,7 @@ defined_grammar_gen<LexIteratorT>::parse_operator_defined (
{
using namespace boost::spirit::classic;
using namespace boost::wave;
defined_grammar<token_sequence_type> g(found_qualified_name);
return boost::spirit::classic::parse (
first, last, g, ch_p(T_SPACE) | ch_p(T_CCOMMENT));

View File

@@ -33,7 +33,7 @@
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace grammars {
template <typename LexIteratorT>
@@ -43,9 +43,9 @@ struct BOOST_WAVE_DECL defined_grammar_gen
typedef std::list<token_type, boost::fast_pool_allocator<token_type> >
token_sequence_type;
// The parse_operator_defined function is instantiated manually twice to
// simplify the explicit specialization of this template. This way the user
// has only to specify one template parameter (the lexer iterator type) to
// The parse_operator_defined function is instantiated manually twice to
// simplify the explicit specialization of this template. This way the user
// has only to specify one template parameter (the lexer iterator type) to
// correctly formulate the required explicit specialization.
// This results in no code overhead, because otherwise the function would be
// generated by the compiler twice anyway.
@@ -57,14 +57,14 @@ struct BOOST_WAVE_DECL defined_grammar_gen
typedef boost::wave::util::unput_queue_iterator<
LexIteratorT, token_type, token_sequence_type>
iterator2_type;
// parse the operator defined and return the found qualified name
static boost::spirit::classic::parse_info<iterator1_type>
parse_operator_defined (iterator1_type const &first,
static boost::spirit::classic::parse_info<iterator1_type>
parse_operator_defined (iterator1_type const &first,
iterator1_type const &last, token_sequence_type &found_qualified_name);
static boost::spirit::classic::parse_info<iterator2_type>
parse_operator_defined (iterator2_type const &first,
static boost::spirit::classic::parse_info<iterator2_type>
parse_operator_defined (iterator2_type const &first,
iterator2_type const &last, token_sequence_type &found_qualified_name);
};

View File

@@ -29,8 +29,8 @@
#include <boost/wave/token_ids.hpp>
#include <boost/wave/cpp_exceptions.hpp>
#include <boost/wave/grammars/cpp_expression_grammar_gen.hpp>
#include <boost/wave/grammars/cpp_literal_grammar_gen.hpp>
#include <boost/wave/grammars/cpp_expression_grammar_gen.hpp>
#include <boost/wave/grammars/cpp_literal_grammar_gen.hpp>
#include <boost/wave/grammars/cpp_expression_value.hpp>
#include <boost/wave/util/pattern_parser.hpp>
#include <boost/wave/util/macro_helpers.hpp>
@@ -52,7 +52,7 @@
//
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace grammars {
namespace closures {
@@ -60,13 +60,13 @@ namespace closures {
//
// define the closure type used throughout the C++ expression grammar
//
// Throughout this grammar all literal tokens are stored into a
// closure_value variables, which converts the types appropriately, where
// Throughout this grammar all literal tokens are stored into a
// closure_value variables, which converts the types appropriately, where
// required.
//
///////////////////////////////////////////////////////////////////////////////
struct cpp_expr_closure
: boost::spirit::classic::closure<cpp_expr_closure, closure_value>
struct cpp_expr_closure
: boost::spirit::classic::closure<cpp_expr_closure, closure_value>
{
member1 val;
};
@@ -83,21 +83,21 @@ namespace impl {
struct convert_intlit {
template <typename ArgT>
struct result {
typedef boost::wave::grammars::closures::closure_value type;
struct result {
typedef boost::wave::grammars::closures::closure_value type;
};
template <typename TokenT>
boost::wave::grammars::closures::closure_value
boost::wave::grammars::closures::closure_value
operator()(TokenT const &token) const
{
{
typedef boost::wave::grammars::closures::closure_value return_type;
bool is_unsigned = false;
uint_literal_type ul = intlit_grammar_gen<TokenT>::evaluate(token,
uint_literal_type ul = intlit_grammar_gen<TokenT>::evaluate(token,
is_unsigned);
return is_unsigned ?
return is_unsigned ?
return_type(ul) : return_type(static_cast<int_literal_type>(ul));
}
};
@@ -111,29 +111,29 @@ namespace impl {
struct convert_chlit {
template <typename ArgT>
struct result {
typedef boost::wave::grammars::closures::closure_value type;
struct result {
typedef boost::wave::grammars::closures::closure_value type;
};
template <typename TokenT>
boost::wave::grammars::closures::closure_value
boost::wave::grammars::closures::closure_value
operator()(TokenT const &token) const
{
{
typedef boost::wave::grammars::closures::closure_value return_type;
value_error status = error_noerror;
// If the literal is a wchar_t and wchar_t is represented by a
// signed integral type, then the created value will be signed as
// If the literal is a wchar_t and wchar_t is represented by a
// signed integral type, then the created value will be signed as
// well, otherwise we assume unsigned values.
#if BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_AUTOSELECT
if ('L' == token.get_value()[0] && std::numeric_limits<wchar_t>::is_signed)
if ('L' == token.get_value()[0] && std::numeric_limits<wchar_t>::is_signed)
{
int value = chlit_grammar_gen<int, TokenT>::evaluate(token, status);
return return_type(value, status);
}
#elif BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_FORCE_SIGNED
if ('L' == token.get_value()[0])
if ('L' == token.get_value()[0])
{
int value = chlit_grammar_gen<int, TokenT>::evaluate(token, status);
return return_type(value, status);
@@ -152,17 +152,17 @@ namespace impl {
//
////////////////////////////////////////////////////////////////////////////////
struct operator_questionmark {
template <typename CondT, typename Arg1T, typename Arg2T>
struct result {
typedef boost::wave::grammars::closures::closure_value type;
struct result {
typedef boost::wave::grammars::closures::closure_value type;
};
template <typename CondT, typename Arg1T, typename Arg2T>
boost::wave::grammars::closures::closure_value
boost::wave::grammars::closures::closure_value
operator()(CondT const &cond, Arg1T &val1, Arg2T const &val2) const
{
{
return val1.handle_questionmark(cond, val2);
}
};
@@ -174,46 +174,46 @@ namespace impl {
//
///////////////////////////////////////////////////////////////////////////////
struct operator_to_bool {
template <typename ArgT>
struct result {
typedef boost::wave::grammars::closures::closure_value type;
struct result {
typedef boost::wave::grammars::closures::closure_value type;
};
template <typename ArgT>
boost::wave::grammars::closures::closure_value
boost::wave::grammars::closures::closure_value
operator()(ArgT &val) const
{
{
typedef boost::wave::grammars::closures::closure_value return_type;
return return_type(
boost::wave::grammars::closures::as_bool(val), val.is_valid());
}
};
phoenix::function<operator_to_bool> const to_bool;
///////////////////////////////////////////////////////////////////////////////
//
// Handle explicit type conversion
//
///////////////////////////////////////////////////////////////////////////////
struct operator_as_bool {
template <typename ArgT>
struct result {
typedef bool type;
struct result {
typedef bool type;
};
template <typename ArgT>
bool
operator()(ArgT &val) const
{
{
return boost::wave::grammars::closures::as_bool(val);
}
};
phoenix::function<operator_as_bool> const as_bool;
///////////////////////////////////////////////////////////////////////////////
//
// Handle closure value operators with proper error propagation
@@ -240,11 +240,11 @@ namespace impl {
BOOST_WAVE_BINARYOP(and, &&);
BOOST_WAVE_BINARYOP(or, ||);
BOOST_WAVE_BINARYOP(bitand, &);
BOOST_WAVE_BINARYOP(bitor, |);
BOOST_WAVE_BINARYOP(bitxor, ^);
BOOST_WAVE_BINARYOP(lesseq, <=);
BOOST_WAVE_BINARYOP(less, <);
BOOST_WAVE_BINARYOP(greater, >);
@@ -275,7 +275,7 @@ namespace impl {
/**/
BOOST_WAVE_UNARYOP(neg, !);
#undef BOOST_WAVE_UNARYOP
} // namespace impl
@@ -288,20 +288,20 @@ namespace impl {
struct expression_grammar :
public boost::spirit::classic::grammar<
expression_grammar,
expression_grammar,
closures::cpp_expr_closure::context_t
>
{
expression_grammar()
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "expression_grammar",
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "expression_grammar",
TRACE_CPP_EXPR_GRAMMAR);
}
// no need for copy constructor/assignment operator
expression_grammar(expression_grammar const&);
expression_grammar& operator= (expression_grammar const&);
template <typename ScannerT>
struct definition
{
@@ -310,7 +310,7 @@ struct expression_grammar :
typedef boost::spirit::classic::rule<ScannerT> simple_rule_t;
simple_rule_t pp_expression;
rule_t const_exp;
rule_t logical_or_exp, logical_and_exp;
rule_t inclusive_or_exp, exclusive_or_exp, and_exp;
@@ -335,11 +335,11 @@ struct expression_grammar :
using namespace phoenix;
using namespace boost::wave;
using boost::wave::util::pattern_p;
pp_expression
= const_exp[self.val = arg1]
;
const_exp
= logical_or_exp[const_exp.val = arg1]
>> !(const_exp_subrule =
@@ -347,18 +347,18 @@ struct expression_grammar :
>> const_exp
[
const_exp_subrule.val = arg1
]
]
>> ch_p(T_COLON)
>> const_exp
[
const_exp_subrule.val =
impl::questionmark(const_exp.val,
const_exp_subrule.val =
impl::questionmark(const_exp.val,
const_exp_subrule.val, arg1)
]
)[const_exp.val = arg1]
;
logical_or_exp
logical_or_exp
= logical_and_exp[logical_or_exp.val = arg1]
>> *( if_p(impl::as_bool(logical_or_exp.val))
[
@@ -367,7 +367,7 @@ struct expression_grammar :
pattern_p(T_OROR, MainTokenMask)
>> logical_and_exp_nocalc
[
logical_or_exp.val =
logical_or_exp.val =
impl::to_bool(logical_or_exp.val)
]
]
@@ -376,7 +376,7 @@ struct expression_grammar :
pattern_p(T_OROR, MainTokenMask)
>> logical_and_exp
[
logical_or_exp.val =
logical_or_exp.val =
impl::binary_or(logical_or_exp.val, arg1)
]
]
@@ -390,7 +390,7 @@ struct expression_grammar :
pattern_p(T_ANDAND, MainTokenMask)
>> inclusive_or_exp
[
logical_and_exp.val =
logical_and_exp.val =
impl::binary_and(logical_and_exp.val, arg1)
]
]
@@ -413,7 +413,7 @@ struct expression_grammar :
>> *( pattern_p(T_OR, MainTokenMask)
>> exclusive_or_exp
[
inclusive_or_exp.val =
inclusive_or_exp.val =
impl::binary_bitor(inclusive_or_exp.val, arg1)
]
)
@@ -424,7 +424,7 @@ struct expression_grammar :
>> *( pattern_p(T_XOR, MainTokenMask)
>> and_exp
[
exclusive_or_exp.val =
exclusive_or_exp.val =
impl::binary_bitxor(exclusive_or_exp.val, arg1)
]
)
@@ -435,7 +435,7 @@ struct expression_grammar :
>> *( pattern_p(T_AND, MainTokenMask)
>> cmp_equality
[
and_exp.val =
and_exp.val =
impl::binary_bitand(and_exp.val, arg1)
]
)
@@ -446,13 +446,13 @@ struct expression_grammar :
>> *( ch_p(T_EQUAL)
>> cmp_relational
[
cmp_equality.val =
cmp_equality.val =
impl::binary_eq(cmp_equality.val, arg1)
]
| pattern_p(T_NOTEQUAL, MainTokenMask)
>> cmp_relational
[
cmp_equality.val =
cmp_equality.val =
impl::binary_ne(cmp_equality.val, arg1)
]
)
@@ -463,25 +463,25 @@ struct expression_grammar :
>> *( ch_p(T_LESSEQUAL)
>> shift_exp
[
cmp_relational.val =
cmp_relational.val =
impl::binary_lesseq(cmp_relational.val, arg1)
]
| ch_p(T_GREATEREQUAL)
>> shift_exp
[
cmp_relational.val =
cmp_relational.val =
impl::binary_greateq(cmp_relational.val, arg1)
]
| ch_p(T_LESS)
>> shift_exp
[
cmp_relational.val =
cmp_relational.val =
impl::binary_less(cmp_relational.val, arg1)
]
| ch_p(T_GREATER)
>> shift_exp
[
cmp_relational.val =
cmp_relational.val =
impl::binary_greater(cmp_relational.val, arg1)
]
)
@@ -559,27 +559,27 @@ struct expression_grammar :
primary_exp
= constant[primary_exp.val = arg1]
| ch_p(T_LEFTPAREN)
| ch_p(T_LEFTPAREN)
>> const_exp[primary_exp.val = arg1]
>> ch_p(T_RIGHTPAREN)
;
constant
= ch_p(T_PP_NUMBER)
= ch_p(T_PP_NUMBER)
[
constant.val = impl::as_intlit(arg1)
]
| ch_p(T_INTLIT)
| ch_p(T_INTLIT)
[
constant.val = impl::as_intlit(arg1)
]
| ch_p(T_CHARLIT)
| ch_p(T_CHARLIT)
[
constant.val = impl::as_chlit(arg1)
]
;
// here follows the same grammar, but without any embedded
// here follows the same grammar, but without any embedded
// calculations
const_exp_nocalc
= logical_or_exp_nocalc
@@ -590,7 +590,7 @@ struct expression_grammar :
)
;
logical_or_exp_nocalc
logical_or_exp_nocalc
= logical_and_exp_nocalc
>> *( pattern_p(T_OROR, MainTokenMask)
>> logical_and_exp_nocalc
@@ -686,15 +686,15 @@ struct expression_grammar :
primary_exp_nocalc
= constant_nocalc
| ch_p(T_LEFTPAREN)
| ch_p(T_LEFTPAREN)
>> const_exp_nocalc
>> ch_p(T_RIGHTPAREN)
;
constant_nocalc
= ch_p(T_PP_NUMBER)
| ch_p(T_INTLIT)
| ch_p(T_CHARLIT)
= ch_p(T_PP_NUMBER)
| ch_p(T_INTLIT)
| ch_p(T_CHARLIT)
;
BOOST_SPIRIT_DEBUG_TRACE_RULE(pp_expression, TRACE_CPP_EXPR_GRAMMAR);
@@ -740,54 +740,54 @@ struct expression_grammar :
#undef TRACE_CPP_EXPR_GRAMMAR
///////////////////////////////////////////////////////////////////////////////
//
// The following function is defined here, to allow the separation of
//
// The following function is defined here, to allow the separation of
// the compilation of the expression_grammar from the function using it.
//
//
///////////////////////////////////////////////////////////////////////////////
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_EXPRGRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_EXPRGRAMMAR_GEN_INLINE inline
#endif
#endif
template <typename TokenT>
BOOST_WAVE_EXPRGRAMMAR_GEN_INLINE
bool
BOOST_WAVE_EXPRGRAMMAR_GEN_INLINE
bool
expression_grammar_gen<TokenT>::evaluate(
typename token_sequence_type::const_iterator const &first,
typename token_sequence_type::const_iterator const &last,
typename token_sequence_type::const_iterator const &first,
typename token_sequence_type::const_iterator const &last,
typename token_type::position_type const &act_pos,
bool if_block_status, value_error &status)
{
using namespace boost::spirit::classic;
using namespace boost::wave;
using namespace boost::wave::grammars::closures;
using boost::wave::util::impl::as_string;
typedef typename token_sequence_type::const_iterator iterator_type;
typedef typename token_sequence_type::value_type::string_type string_type;
parse_info<iterator_type> hit(first);
closure_value result; // expression result
#if !defined(BOOST_NO_EXCEPTIONS)
try
try
#endif
{
expression_grammar g; // expression grammar
hit = parse (first, last, g[spirit_assign_actor(result)],
hit = parse (first, last, g[spirit_assign_actor(result)],
ch_p(T_SPACE) | ch_p(T_CCOMMENT) | ch_p(T_CPPCOMMENT));
if (!hit.hit) {
// expression is illformed
if (if_block_status) {
string_type expression = as_string<string_type>(first, last);
if (0 == expression.size())
if (0 == expression.size())
expression = "<empty expression>";
BOOST_WAVE_THROW(preprocess_exception, ill_formed_expression,
BOOST_WAVE_THROW(preprocess_exception, ill_formed_expression,
expression.c_str(), act_pos);
return false;
}
@@ -812,13 +812,13 @@ expression_grammar_gen<TokenT>::evaluate(
#endif
if (!hit.full) {
// The token list starts with a valid expression, but there remains
// something. If the remainder consists out of whitespace only, the
// The token list starts with a valid expression, but there remains
// something. If the remainder consists out of whitespace only, the
// expression is still valid.
iterator_type next = hit.stop;
while (next != last) {
switch (static_cast<unsigned int>(token_id(*next))) {
switch (token_id(*next)) {
case T_SPACE:
case T_SPACE2:
case T_CCOMMENT:
@@ -833,9 +833,9 @@ expression_grammar_gen<TokenT>::evaluate(
// expression is illformed
if (if_block_status) {
string_type expression = as_string<string_type>(first, last);
if (0 == expression.size())
if (0 == expression.size())
expression = "<empty expression>";
BOOST_WAVE_THROW(preprocess_exception, ill_formed_expression,
BOOST_WAVE_THROW(preprocess_exception, ill_formed_expression,
expression.c_str(), act_pos);
return false;
}
@@ -850,7 +850,7 @@ expression_grammar_gen<TokenT>::evaluate(
if (error_noerror != result.is_valid()) // division or other error by zero occurred
status = result.is_valid();
// token sequence is a valid expression
return as_bool(result);
}

View File

@@ -35,11 +35,11 @@ namespace wave {
namespace grammars {
///////////////////////////////////////////////////////////////////////////////
//
//
// expression_grammar_gen template class
//
// This template helps separating the compilation of the
// expression_grammar class from the compilation of the main
// This template helps separating the compilation of the
// expression_grammar class from the compilation of the main
// pp_iterator. This is done to safe compilation time.
//
///////////////////////////////////////////////////////////////////////////////
@@ -52,15 +52,15 @@ struct BOOST_WAVE_DECL expression_grammar_gen {
token_sequence_type;
static bool evaluate(
typename token_sequence_type::const_iterator const &first,
typename token_sequence_type::const_iterator const &last,
typename token_sequence_type::const_iterator const &first,
typename token_sequence_type::const_iterator const &last,
typename token_type::position_type const &tok,
bool if_block_status, value_error &status);
};
///////////////////////////////////////////////////////////////////////////////
} // namespace grammars
} // namespace wave
} // namespace wave
} // namespace boost
#ifdef BOOST_MSVC

View File

@@ -34,10 +34,10 @@ inline bool as_bool(closure_value const& v);
///////////////////////////////////////////////////////////////////////////////
//
// The closure_value class represents the closure type, which is used for the
// expression grammar.
// The closure_value class represents the closure type, which is used for the
// expression grammar.
//
// This class was introduced to allow the expression grammar to respect
// This class was introduced to allow the expression grammar to respect
// the numeric type of a numeric literal or expression result.
//
///////////////////////////////////////////////////////////////////////////////
@@ -49,29 +49,29 @@ public:
is_uint = 2,
is_bool = 3
};
closure_value(value_error valid_ = error_noerror)
: type(is_int), valid(valid_)
closure_value(value_error valid_ = error_noerror)
: type(is_int), valid(valid_)
{ value.i = 0; }
explicit closure_value(int i, value_error valid_ = error_noerror)
: type(is_int), valid(valid_)
explicit closure_value(int i, value_error valid_ = error_noerror)
: type(is_int), valid(valid_)
{ value.i = i; }
explicit closure_value(unsigned int ui, value_error valid_ = error_noerror)
: type(is_uint), valid(valid_)
explicit closure_value(unsigned int ui, value_error valid_ = error_noerror)
: type(is_uint), valid(valid_)
{ value.ui = ui; }
explicit closure_value(int_literal_type i, value_error valid_ = error_noerror)
: type(is_int), valid(valid_)
explicit closure_value(int_literal_type i, value_error valid_ = error_noerror)
: type(is_int), valid(valid_)
{ value.i = i; }
explicit closure_value(uint_literal_type ui, value_error valid_ = error_noerror)
: type(is_uint), valid(valid_)
explicit closure_value(uint_literal_type ui, value_error valid_ = error_noerror)
: type(is_uint), valid(valid_)
{ value.ui = ui; }
explicit closure_value(bool b, value_error valid_ = error_noerror)
: type(is_bool), valid(valid_)
explicit closure_value(bool b, value_error valid_ = error_noerror)
: type(is_bool), valid(valid_)
{ value.b = b; }
value_type get_type() const { return type; }
value_error is_valid() const { return valid; }
// explicit conversion
friend int_literal_type as_int(closure_value const& v)
{
@@ -91,7 +91,7 @@ public:
}
return v.value.i;
}
friend int_literal_type as_long(closure_value const& v)
friend int_literal_type as_long(closure_value const& v)
{
switch (v.type) {
case is_uint: return v.value.ui;
@@ -119,21 +119,21 @@ public:
return v.value.i != 0.0;
}
// assignment
// assignment
closure_value &operator= (closure_value const &rhs)
{
switch (rhs.get_type()) {
case is_int:
value.i = as_long(rhs);
case is_int:
value.i = as_long(rhs);
type = is_int;
break;
case is_uint:
value.ui = as_ulong(rhs);
case is_uint:
value.ui = as_ulong(rhs);
type = is_uint;
break;
case is_bool:
case is_bool:
value.b = as_bool(rhs);
type = is_bool;
break;
@@ -181,12 +181,12 @@ public:
closure_value &operator+= (closure_value const &rhs)
{
switch (type) {
case is_int:
case is_int:
switch(rhs.type) {
case is_bool:
{
int_literal_type result = value.i + as_long(rhs);
if ((rhs.value.i > 0L && value.i > result) ||
int_literal_type result = value.i + as_long(rhs);
if ((rhs.value.i > 0L && value.i > result) ||
(rhs.value.i < 0L && value.i < result))
{
valid = error_integer_overflow;
@@ -196,11 +196,11 @@ public:
}
}
break;
case is_int:
{
int_literal_type result = value.i + rhs.value.i;
if ((rhs.value.i > 0L && value.i > result) ||
if ((rhs.value.i > 0L && value.i > result) ||
(rhs.value.i < 0L && value.i < result))
{
valid = error_integer_overflow;
@@ -210,25 +210,25 @@ public:
}
}
break;
case is_uint:
{
uint_literal_type result = value.ui + rhs.value.ui;
uint_literal_type result = value.ui + rhs.value.ui;
if (result < value.ui) {
valid = error_integer_overflow;
}
else {
value.ui = result;
type = is_uint;
type = is_uint;
}
}
break;
}
break;
case is_uint:
{
uint_literal_type result = value.ui + as_ulong(rhs);
uint_literal_type result = value.ui + as_ulong(rhs);
if (result < value.ui) {
valid = error_integer_overflow;
}
@@ -237,8 +237,8 @@ public:
}
}
break;
case is_bool:
case is_bool:
value.i = value.b + as_bool(rhs);
type = is_int;
}
@@ -252,8 +252,8 @@ public:
switch(rhs.type) {
case is_bool:
{
int_literal_type result = value.i - as_long(rhs);
if ((rhs.value.i > 0L && result > value.i) ||
int_literal_type result = value.i - as_long(rhs);
if ((rhs.value.i > 0L && result > value.i) ||
(rhs.value.i < 0L && result < value.i))
{
valid = error_integer_overflow;
@@ -267,7 +267,7 @@ public:
case is_int:
{
int_literal_type result = value.i - rhs.value.i;
if ((rhs.value.i > 0L && result > value.i) ||
if ((rhs.value.i > 0L && result > value.i) ||
(rhs.value.i < 0L && result < value.i))
{
valid = error_integer_overflow;
@@ -277,27 +277,27 @@ public:
}
}
break;
case is_uint:
{
uint_literal_type result = value.ui - rhs.value.ui;
uint_literal_type result = value.ui - rhs.value.ui;
if (result > value.ui) {
valid = error_integer_overflow;
}
else {
value.ui = result;
type = is_uint;
type = is_uint;
}
}
break;
}
break;
case is_uint:
switch(rhs.type) {
case is_bool:
{
uint_literal_type result = value.ui - as_ulong(rhs);
uint_literal_type result = value.ui - as_ulong(rhs);
if (result > value.ui)
{
valid = error_integer_overflow;
@@ -311,7 +311,7 @@ public:
case is_int:
{
uint_literal_type result = value.ui - rhs.value.i;
if ((rhs.value.i > 0L && result > value.ui) ||
if ((rhs.value.i > 0L && result > value.ui) ||
(rhs.value.i < 0L && result < value.ui))
{
valid = error_integer_overflow;
@@ -321,10 +321,10 @@ public:
}
}
break;
case is_uint:
{
uint_literal_type result = value.ui - rhs.value.ui;
uint_literal_type result = value.ui - rhs.value.ui;
if (result > value.ui) {
valid = error_integer_overflow;
}
@@ -336,7 +336,7 @@ public:
}
break;
case is_bool:
case is_bool:
value.i = value.b - as_bool(rhs);
type = is_int;
}
@@ -346,12 +346,12 @@ public:
closure_value &operator*= (closure_value const &rhs)
{
switch (type) {
case is_int:
case is_int:
switch(rhs.type) {
case is_bool: value.i *= as_long(rhs); break;
case is_int:
{
int_literal_type result = value.i * rhs.value.i;
int_literal_type result = value.i * rhs.value.i;
if (0 != value.i && 0 != rhs.value.i &&
(result / value.i != rhs.value.i ||
result / rhs.value.i != value.i)
@@ -364,10 +364,10 @@ public:
}
}
break;
case is_uint:
{
uint_literal_type result = value.ui * rhs.value.ui;
uint_literal_type result = value.ui * rhs.value.ui;
if (0 != value.ui && 0 != rhs.value.ui &&
(result / value.ui != rhs.value.ui ||
result / rhs.value.ui != value.ui)
@@ -377,17 +377,17 @@ public:
}
else {
value.ui = result;
type = is_uint;
type = is_uint;
}
}
break;
}
break;
case is_uint:
{
uint_literal_type rhs_val = as_ulong(rhs);
uint_literal_type result = value.ui * rhs_val;
uint_literal_type result = value.ui * rhs_val;
if (0 != value.ui && 0 != rhs_val &&
(result / value.ui != rhs_val ||
result / rhs_val != value.ui)
@@ -397,23 +397,23 @@ public:
}
else {
value.ui = result;
type = is_uint;
type = is_uint;
}
}
break;
case is_bool:
switch (rhs.type) {
case is_int:
value.i = (value.b ? 1 : 0) * rhs.value.i;
type = is_int;
value.i = (value.b ? 1 : 0) * rhs.value.i;
type = is_int;
break;
case is_uint:
value.ui = (value.b ? 1 : 0) * rhs.value.ui;
type = is_uint;
value.ui = (value.b ? 1 : 0) * rhs.value.ui;
type = is_uint;
break;
case is_bool:
value.b = 0 != ((value.b ? 1 : 0) * (rhs.value.b ? 1 : 0));
break;
@@ -425,9 +425,9 @@ public:
closure_value &operator/= (closure_value const &rhs)
{
switch (type) {
case is_int:
case is_int:
switch(rhs.type) {
case is_bool:
case is_bool:
case is_int:
if (as_long(rhs) != 0) {
if (value.i == -value.i && -1 == rhs.value.i) {
@@ -435,18 +435,18 @@ public:
valid = error_integer_overflow;
}
else {
value.i /= as_long(rhs);
value.i /= as_long(rhs);
}
}
else {
valid = error_division_by_zero; // division by zero
}
break;
case is_uint:
if (rhs.value.ui != 0) {
value.ui /= rhs.value.ui;
type = is_uint;
value.ui /= rhs.value.ui;
type = is_uint;
}
else {
valid = error_division_by_zero; // division by zero
@@ -454,27 +454,27 @@ public:
break;
}
break;
case is_uint:
if (as_ulong(rhs) != 0)
value.ui /= as_ulong(rhs);
case is_uint:
if (as_ulong(rhs) != 0)
value.ui /= as_ulong(rhs);
else
valid = error_division_by_zero; // division by zero
break;
case is_bool:
case is_bool:
if (as_bool(rhs)) {
switch(rhs.type) {
case is_int:
value.i = (value.b ? 1 : 0) / rhs.value.i;
type = is_int;
break;
case is_uint:
value.i = (value.b ? 1 : 0) / rhs.value.ui;
type = is_int;
break;
case is_bool:
break;
}
@@ -488,9 +488,9 @@ public:
closure_value &operator%= (closure_value const &rhs)
{
switch (type) {
case is_int:
case is_int:
switch(rhs.type) {
case is_bool:
case is_bool:
case is_int:
if (as_long(rhs) != 0) {
if (value.i == -value.i && -1 == rhs.value.i) {
@@ -498,18 +498,18 @@ public:
valid = error_integer_overflow;
}
else {
value.i %= as_long(rhs);
value.i %= as_long(rhs);
}
}
else {
valid = error_division_by_zero; // division by zero
}
break;
case is_uint:
if (rhs.value.ui != 0) {
value.ui %= rhs.value.ui;
type = is_uint;
value.ui %= rhs.value.ui;
type = is_uint;
}
else {
valid = error_division_by_zero; // division by zero
@@ -517,30 +517,30 @@ public:
break;
}
break;
case is_uint:
if (as_ulong(rhs) != 0)
value.ui %= as_ulong(rhs);
case is_uint:
if (as_ulong(rhs) != 0)
value.ui %= as_ulong(rhs);
else
valid = error_division_by_zero; // division by zero
break;
case is_bool:
case is_bool:
if (as_bool(rhs)) {
switch(rhs.type) {
case is_int:
value.i = (value.b ? 1 : 0) % rhs.value.i;
type = is_int;
break;
case is_uint:
value.i = (value.b ? 1 : 0) % rhs.value.ui;
type = is_int;
break;
case is_bool:
break;
}
}
}
else {
valid = error_division_by_zero; // division by zero
@@ -549,7 +549,7 @@ public:
return *this;
}
friend closure_value
friend closure_value
operator- (closure_value const &rhs)
{
switch (rhs.type) {
@@ -560,8 +560,8 @@ public:
return closure_value(-value, error_integer_overflow);
return closure_value(-value, rhs.valid);
}
case is_bool: return closure_value(-as_long(rhs), rhs.valid);
case is_bool: return closure_value(-as_long(rhs), rhs.valid);
case is_uint: break;
}
@@ -570,24 +570,24 @@ public:
return closure_value(-value, error_integer_overflow);
return closure_value(-value, rhs.valid);
}
friend closure_value
friend closure_value
operator~ (closure_value const &rhs)
{
return closure_value(~as_ulong(rhs), rhs.valid);
return closure_value(~as_ulong(rhs), rhs.valid);
}
friend closure_value
friend closure_value
operator! (closure_value const &rhs)
{
switch (rhs.type) {
case is_int: return closure_value(!as_long(rhs), rhs.valid);
case is_bool: return closure_value(!as_bool(rhs), rhs.valid);
case is_bool: return closure_value(!as_bool(rhs), rhs.valid);
case is_uint: break;
}
return closure_value(!as_ulong(rhs), rhs.valid);
}
// comparison
friend closure_value
friend closure_value
operator== (closure_value const &lhs, closure_value const &rhs)
{
bool cmp = false;
@@ -599,18 +599,18 @@ public:
case is_uint: cmp = lhs.value.ui == rhs.value.ui; break;
}
break;
case is_uint: cmp = lhs.value.ui == as_ulong(rhs); break;
case is_bool: cmp = lhs.value.b == as_bool(rhs); break;
}
return closure_value(cmp, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator!= (closure_value const &lhs, closure_value const &rhs)
{
return closure_value(!as_bool(lhs == rhs), (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator> (closure_value const &lhs, closure_value const &rhs)
{
bool cmp = false;
@@ -622,13 +622,13 @@ public:
case is_uint: cmp = lhs.value.ui > rhs.value.ui; break;
}
break;
case is_uint: cmp = lhs.value.ui > as_ulong(rhs); break;
case is_bool: cmp = lhs.value.b > as_bool(rhs); break;
}
return closure_value(cmp, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator< (closure_value const &lhs, closure_value const &rhs)
{
bool cmp = false;
@@ -640,18 +640,18 @@ public:
case is_uint: cmp = lhs.value.ui < rhs.value.ui; break;
}
break;
case is_uint: cmp = lhs.value.ui < as_ulong(rhs); break;
case is_bool: cmp = as_bool(lhs) < as_bool(rhs); break;
}
return closure_value(cmp, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator<= (closure_value const &lhs, closure_value const &rhs)
{
return closure_value(!as_bool(lhs > rhs), (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator>= (closure_value const &lhs, closure_value const &rhs)
{
return closure_value(!as_bool(lhs < rhs), (value_error)(lhs.valid | rhs.valid));
@@ -668,24 +668,24 @@ public:
case is_int:
{
int_literal_type shift_by = as_long(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
else if (shift_by < -64)
shift_by = -64;
value.i <<= shift_by;
value.i <<= shift_by;
}
break;
case is_uint:
{
uint_literal_type shift_by = as_ulong(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
value.ui <<= shift_by;
// Note: The usual arithmetic conversions are not performed on
value.ui <<= shift_by;
// Note: The usual arithmetic conversions are not performed on
// bit shift operations.
}
break;
@@ -698,22 +698,22 @@ public:
case is_int:
{
int_literal_type shift_by = as_long(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
else if (shift_by < -64)
shift_by = -64;
value.ui <<= shift_by;
value.ui <<= shift_by;
}
break;
case is_uint:
{
uint_literal_type shift_by = as_ulong(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
value.ui <<= shift_by;
value.ui <<= shift_by;
}
break;
}
@@ -733,52 +733,52 @@ public:
case is_int:
{
int_literal_type shift_by = as_long(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
else if (shift_by < -64)
shift_by = -64;
value.i >>= shift_by;
value.i >>= shift_by;
}
break;
case is_uint:
{
uint_literal_type shift_by = as_ulong(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
value.ui >>= shift_by;
// Note: The usual arithmetic conversions are not performed on
value.ui >>= shift_by;
// Note: The usual arithmetic conversions are not performed on
// bit shift operations.
}
break;
}
break;
case is_uint:
switch (rhs.type) {
case is_bool:
case is_int:
{
int_literal_type shift_by = as_long(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
else if (shift_by < -64)
shift_by = -64;
value.ui >>= shift_by;
value.ui >>= shift_by;
}
break;
case is_uint:
{
uint_literal_type shift_by = as_ulong(rhs);
if (shift_by > 64)
if (shift_by > 64)
shift_by = 64;
value.ui >>= shift_by;
value.ui >>= shift_by;
}
break;
}
@@ -788,41 +788,41 @@ public:
return *this;
}
friend closure_value
friend closure_value
operator|| (closure_value const &lhs, closure_value const &rhs)
{
bool result = as_bool(lhs) || as_bool(rhs);
return closure_value(result, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator&& (closure_value const &lhs, closure_value const &rhs)
{
bool result = as_bool(lhs) && as_bool(rhs);
return closure_value(result, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator| (closure_value const &lhs, closure_value const &rhs)
{
uint_literal_type result = as_ulong(lhs) | as_ulong(rhs);
return closure_value(result, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator& (closure_value const &lhs, closure_value const &rhs)
{
uint_literal_type result = as_ulong(lhs) & as_ulong(rhs);
return closure_value(result, (value_error)(lhs.valid | rhs.valid));
}
friend closure_value
friend closure_value
operator^ (closure_value const &lhs, closure_value const &rhs)
{
uint_literal_type result = as_ulong(lhs) ^ as_ulong(rhs);
return closure_value(result, (value_error)(lhs.valid | rhs.valid));
}
// handle the ?: operator
closure_value &
handle_questionmark(closure_value const &cond, closure_value const &val2)
@@ -832,20 +832,20 @@ public:
switch (val2.type) {
case is_bool: value.b = as_bool(cond) ? value.b : as_bool(val2); break;
case is_int: value.i = as_bool(cond) ? value.i : as_long(val2); break;
case is_uint:
value.ui = as_bool(cond) ? value.ui : as_ulong(val2);
case is_uint:
value.ui = as_bool(cond) ? value.ui : as_ulong(val2);
type = is_uint; // changing type!
break;
}
break;
case is_uint: value.ui = as_bool(cond) ? value.ui : as_ulong(val2); break;
case is_bool: value.b = as_bool(cond) ? value.b : as_bool(val2); break;
}
valid = as_bool(cond) ? valid : val2.valid;
return *this;
}
#if defined (BOOST_SPIRIT_DEBUG)
friend std::ostream&
operator<< (std::ostream &o, closure_value const &val)

View File

@@ -38,7 +38,7 @@
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace grammars {
namespace impl {
@@ -47,7 +47,7 @@ namespace impl {
//
// store_found_eof
//
// The store_found_eof functor sets a given flag if the T_EOF token was
// The store_found_eof functor sets a given flag if the T_EOF token was
// found during the parsing process
//
///////////////////////////////////////////////////////////////////////////////
@@ -55,13 +55,13 @@ namespace impl {
struct store_found_eof {
store_found_eof(bool &found_eof_) : found_eof(found_eof_) {}
template <typename TokenT>
void operator()(TokenT const &/*token*/) const
{
found_eof = true;
}
bool &found_eof;
};
@@ -77,14 +77,14 @@ namespace impl {
template <typename TokenT>
struct store_found_directive {
store_found_directive(TokenT &found_directive_)
store_found_directive(TokenT &found_directive_)
: found_directive(found_directive_) {}
void operator()(TokenT const &token) const
{
found_directive = token;
}
TokenT &found_directive;
};
@@ -92,7 +92,7 @@ namespace impl {
//
// store_found_eoltokens
//
// The store_found_eoltokens functor stores the token sequence of the
// The store_found_eoltokens functor stores the token sequence of the
// line ending for a particular pp directive
//
///////////////////////////////////////////////////////////////////////////////
@@ -100,16 +100,16 @@ namespace impl {
template <typename ContainerT>
struct store_found_eoltokens {
store_found_eoltokens(ContainerT &found_eoltokens_)
store_found_eoltokens(ContainerT &found_eoltokens_)
: found_eoltokens(found_eoltokens_) {}
template <typename IteratorT>
void operator()(IteratorT const &first, IteratorT const& last) const
{
std::copy(first, last,
std::copy(first, last,
std::inserter(found_eoltokens, found_eoltokens.end()));
}
ContainerT &found_eoltokens;
};
@@ -134,11 +134,11 @@ namespace impl {
parse(ScannerT const& scan) const
{
scan.first.clear_queue();
return scan.empty_match();
return scan.empty_match();
}
};
flush_underlying_parser const
flush_underlying_parser const
flush_underlying_parser_p = flush_underlying_parser();
} // anonymous namespace
@@ -152,7 +152,7 @@ namespace impl {
///////////////////////////////////////////////////////////////////////////////
// Encapsulation of the C++ preprocessor grammar.
template <typename TokenT, typename ContainerT>
struct cpp_grammar :
struct cpp_grammar :
public boost::spirit::classic::grammar<cpp_grammar<TokenT, ContainerT> >
{
typedef typename TokenT::position_type position_type;
@@ -160,7 +160,7 @@ struct cpp_grammar :
typedef impl::store_found_eof store_found_eof_type;
typedef impl::store_found_directive<TokenT> store_found_directive_type;
typedef impl::store_found_eoltokens<ContainerT> store_found_eoltokens_type;
template <typename ScannerT>
struct definition
{
@@ -168,22 +168,22 @@ struct cpp_grammar :
typedef typename ScannerT::iteration_policy_t iteration_policy_t;
typedef boost::spirit::classic::match_policy match_policy_t;
typedef typename ScannerT::action_policy_t action_policy_t;
typedef
typedef
boost::spirit::classic::scanner_policies<
iteration_policy_t, match_policy_t, action_policy_t>
iteration_policy_t, match_policy_t, action_policy_t>
policies_t;
typedef
boost::spirit::classic::scanner<typename ScannerT::iterator_t, policies_t>
typedef
boost::spirit::classic::scanner<typename ScannerT::iterator_t, policies_t>
non_tree_scanner_t;
typedef
typedef
boost::spirit::classic::rule<
non_tree_scanner_t, boost::spirit::classic::dynamic_parser_tag>
non_tree_scanner_t, boost::spirit::classic::dynamic_parser_tag>
no_tree_rule_type;
// 'normal' (parse_tree generating) rule type
typedef
typedef
boost::spirit::classic::rule<
ScannerT, boost::spirit::classic::dynamic_parser_tag>
ScannerT, boost::spirit::classic::dynamic_parser_tag>
rule_type;
rule_type pp_statement, macro_include_file;
@@ -192,7 +192,7 @@ struct cpp_grammar :
rule_type undefine;
rule_type ppifdef, ppifndef, ppif, ppelif;
// rule_type ppelse, ppendif;
rule_type ppline;
rule_type ppline;
rule_type pperror;
rule_type ppwarning;
rule_type pppragma;
@@ -205,7 +205,7 @@ struct cpp_grammar :
rule_type ppendregion;
#endif
definition(cpp_grammar const &self)
definition(cpp_grammar const &self)
{
// import the spirit and cpplexer namespaces here
using namespace boost::spirit::classic;
@@ -241,16 +241,16 @@ struct cpp_grammar :
#if BOOST_WAVE_DUMP_PARSE_TREE != 0
self.map_rule_id_to_name.init_rule_id_to_name_map(self);
#endif
#endif
// recognizes preprocessor directives only
// C++ standard 16.1: A preprocessing directive consists of a sequence
// of preprocessing tokens. The first token in the sequence is #
// preprocessing token that is either the first character in the source
// file (optionally after white space containing no new-line
// characters) or that follows white space containing at least one
// new-line character. The last token in the sequence is the first
// C++ standard 16.1: A preprocessing directive consists of a sequence
// of preprocessing tokens. The first token in the sequence is #
// preprocessing token that is either the first character in the source
// file (optionally after white space containing no new-line
// characters) or that follows white space containing at least one
// new-line character. The last token in the sequence is the first
// new-line character that follows the first token in the sequence.
pp_statement
@@ -290,21 +290,21 @@ struct cpp_grammar :
// // #include ...
// include_file // include "..."
// = ch_p(T_PP_QHEADER)
// = ch_p(T_PP_QHEADER)
// [ store_found_directive_type(self.found_directive) ]
// #if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
// | ch_p(T_PP_QHEADER_NEXT)
// [ store_found_directive_type(self.found_directive) ]
// #endif
// #endif
// ;
// system_include_file // include <...>
// = ch_p(T_PP_HHEADER)
// = ch_p(T_PP_HHEADER)
// [ store_found_directive_type(self.found_directive) ]
// #if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
// | ch_p(T_PP_HHEADER_NEXT)
// [ store_found_directive_type(self.found_directive) ]
// #endif
// #endif
// ;
macro_include_file // include ...anything else...
@@ -318,7 +318,7 @@ struct cpp_grammar :
#endif
]
>> *( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
@@ -326,23 +326,23 @@ struct cpp_grammar :
plain_define
= no_node_d
[
ch_p(T_PP_DEFINE)
ch_p(T_PP_DEFINE)
[ store_found_directive_type(self.found_directive) ]
>> +ppsp
]
>> ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
>> ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
| pattern_p(OperatorTokenType|AltExtTokenType,
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
| pattern_p(BoolLiteralTokenType,
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag) // true/false
)
>> ( ( no_node_d[eps_p(ch_p(T_LEFTPAREN))]
>> macro_parameters
>> !macro_definition
)
| !( no_node_d[+ppsp]
| !( no_node_d[+ppsp]
>> macro_definition
)
)
@@ -354,45 +354,45 @@ struct cpp_grammar :
= confix_p(
no_node_d[ch_p(T_LEFTPAREN) >> *ppsp],
!list_p(
( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
| pattern_p(OperatorTokenType|AltExtTokenType,
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
| pattern_p(BoolLiteralTokenType,
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag) // true/false
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
| ch_p(T_ELLIPSIS)
#endif
),
),
no_node_d[*ppsp >> ch_p(T_COMMA) >> *ppsp]
),
no_node_d[*ppsp >> ch_p(T_RIGHTPAREN)]
)
;
// macro body (anything left until eol)
macro_definition
= no_node_d[*ppsp]
>> *( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
// #undef FOO
// #undef FOO
undefine
= no_node_d
[
ch_p(T_PP_UNDEF)
ch_p(T_PP_UNDEF)
[ store_found_directive_type(self.found_directive) ]
>> +ppsp
]
>> ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
>> ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
| pattern_p(OperatorTokenType|AltExtTokenType,
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
| pattern_p(BoolLiteralTokenType,
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag) // true/false
)
;
@@ -401,7 +401,7 @@ struct cpp_grammar :
ppifdef
= no_node_d
[
ch_p(T_PP_IFDEF)
ch_p(T_PP_IFDEF)
[ store_found_directive_type(self.found_directive) ]
>> +ppsp
]
@@ -411,7 +411,7 @@ struct cpp_grammar :
ppifndef
= no_node_d
[
ch_p(T_PP_IFNDEF)
ch_p(T_PP_IFNDEF)
[ store_found_directive_type(self.found_directive) ]
>> +ppsp
]
@@ -421,12 +421,12 @@ struct cpp_grammar :
ppif
= no_node_d
[
ch_p(T_PP_IF)
ch_p(T_PP_IF)
[ store_found_directive_type(self.found_directive) ]
// >> *ppsp
]
>> +( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
@@ -441,12 +441,12 @@ struct cpp_grammar :
ppelif
= no_node_d
[
ch_p(T_PP_ELIF)
ch_p(T_PP_ELIF)
[ store_found_directive_type(self.found_directive) ]
// >> *ppsp
]
>> +( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
@@ -459,24 +459,24 @@ struct cpp_grammar :
// ;
// #line ...
ppline
ppline
= no_node_d
[
ch_p(T_PP_LINE)
ch_p(T_PP_LINE)
[ store_found_directive_type(self.found_directive) ]
>> *ppsp
]
>> +( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0
// #region ...
ppregion
= no_node_d
[
ch_p(T_MSEXT_PP_REGION)
ch_p(T_MSEXT_PP_REGION)
[ store_found_directive_type(self.found_directive) ]
>> +ppsp
]
@@ -487,7 +487,7 @@ struct cpp_grammar :
ppendregion
= no_node_d
[
ch_p(T_MSEXT_PP_ENDREGION)
ch_p(T_MSEXT_PP_ENDREGION)
[ store_found_directive_type(self.found_directive) ]
]
;
@@ -497,16 +497,16 @@ struct cpp_grammar :
illformed // for error reporting
= no_node_d
[
pattern_p(T_POUND, MainTokenMask)
pattern_p(T_POUND, MainTokenMask)
>> *ppsp
]
>> ( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
>> no_node_d
[
*( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
]
;
@@ -515,12 +515,12 @@ struct cpp_grammar :
pperror
= no_node_d
[
ch_p(T_PP_ERROR)
ch_p(T_PP_ERROR)
[ store_found_directive_type(self.found_directive) ]
>> *ppsp
]
>> *( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
@@ -528,12 +528,12 @@ struct cpp_grammar :
ppwarning
= no_node_d
[
ch_p(T_PP_WARNING)
ch_p(T_PP_WARNING)
[ store_found_directive_type(self.found_directive) ]
>> *ppsp
]
>> *( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
@@ -543,22 +543,22 @@ struct cpp_grammar :
[
ch_p(T_PP_PRAGMA)
[ store_found_directive_type(self.found_directive) ]
]
]
>> *( anychar_p -
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
(ch_p(T_NEWLINE) | ch_p(T_CPPCOMMENT) | ch_p(T_EOF))
)
;
ppqualifiedname
= no_node_d[*ppsp]
>> ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
>> ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
| pattern_p(OperatorTokenType|AltExtTokenType,
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
| pattern_p(BoolLiteralTokenType,
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag) // true/false
)
)
;
// auxiliary helper rules
@@ -567,10 +567,10 @@ struct cpp_grammar :
;
// end of line tokens
eol_tokens
eol_tokens
= no_node_d
[
*( ch_p(T_SPACE)
*( ch_p(T_SPACE)
| ch_p(T_CCOMMENT)
)
>> ( ch_p(T_NEWLINE)
@@ -615,21 +615,21 @@ struct cpp_grammar :
bool &found_eof;
TokenT &found_directive;
ContainerT &found_eoltokens;
cpp_grammar(bool &found_eof_, TokenT &found_directive_,
cpp_grammar(bool &found_eof_, TokenT &found_directive_,
ContainerT &found_eoltokens_)
: found_eof(found_eof_),
: found_eof(found_eof_),
found_directive(found_directive_),
found_eoltokens(found_eoltokens_)
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "cpp_grammar",
TRACE_CPP_GRAMMAR);
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "cpp_grammar",
TRACE_CPP_GRAMMAR);
}
#if BOOST_WAVE_DUMP_PARSE_TREE != 0
// helper function and data to get readable names of the rules known to us
struct map_ruleid_to_name :
public std::map<boost::spirit::classic::parser_id, std::string>
public std::map<boost::spirit::classic::parser_id, std::string>
{
typedef std::map<boost::spirit::classic::parser_id, std::string> base_type;
@@ -638,7 +638,7 @@ struct cpp_grammar :
struct {
int parser_id;
char const *rule_name;
}
}
init_ruleid_name_map[] = {
{ BOOST_WAVE_PP_STATEMENT_ID, "pp_statement" },
// { BOOST_WAVE_INCLUDE_FILE_ID, "include_file" },
@@ -671,7 +671,7 @@ struct cpp_grammar :
// initialize parser_id to rule_name map
for (int i = 0; 0 != init_ruleid_name_map[i].parser_id; ++i)
base_type::insert(base_type::value_type(
boost::spirit::classic::parser_id(init_ruleid_name_map[i].parser_id),
boost::spirit::classic::parser_id(init_ruleid_name_map[i].parser_id),
std::string(init_ruleid_name_map[i].rule_name))
);
}
@@ -694,7 +694,7 @@ parsetree_parse(IteratorT const& first_, IteratorT const& last,
boost::spirit::classic::parser<ParserT> const& p)
{
using namespace boost::spirit::classic;
typedef pt_match_policy<IteratorT, NodeFactoryT> pt_match_policy_type;
typedef scanner_policies<iteration_policy, pt_match_policy_type>
scanner_policies_type;
@@ -709,22 +709,22 @@ parsetree_parse(IteratorT const& first_, IteratorT const& last,
}
///////////////////////////////////////////////////////////////////////////////
//
// The following parse function is defined here, to allow the separation of
//
// The following parse function is defined here, to allow the separation of
// the compilation of the cpp_grammar from the function using it.
//
//
///////////////////////////////////////////////////////////////////////////////
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_GRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_GRAMMAR_GEN_INLINE inline
#endif
#endif
template <typename LexIteratorT, typename TokenContainerT>
BOOST_WAVE_GRAMMAR_GEN_INLINE
BOOST_WAVE_GRAMMAR_GEN_INLINE
boost::spirit::classic::tree_parse_info<
LexIteratorT,
LexIteratorT,
typename cpp_grammar_gen<LexIteratorT, TokenContainerT>::node_factory_type
>
cpp_grammar_gen<LexIteratorT, TokenContainerT>::parse_cpp_grammar (
@@ -734,15 +734,15 @@ cpp_grammar_gen<LexIteratorT, TokenContainerT>::parse_cpp_grammar (
{
using namespace boost::spirit::classic;
using namespace boost::wave;
cpp_grammar<token_type, TokenContainerT> g(found_eof, found_directive, found_eoltokens);
tree_parse_info<LexIteratorT, node_factory_type> hit =
tree_parse_info<LexIteratorT, node_factory_type> hit =
parsetree_parse<node_factory_type>(first, last, g);
#if BOOST_WAVE_DUMP_PARSE_TREE != 0
if (hit.match) {
tree_to_xml (BOOST_WAVE_DUMP_PARSE_TREE_OUT, hit.trees, "",
g.map_rule_id_to_name, &token_type::get_token_id,
tree_to_xml (BOOST_WAVE_DUMP_PARSE_TREE_OUT, hit.trees, "",
g.map_rule_id_to_name, &token_type::get_token_id,
&token_type::get_token_value);
}
#endif
@@ -755,7 +755,7 @@ cpp_grammar_gen<LexIteratorT, TokenContainerT>::parse_cpp_grammar (
///////////////////////////////////////////////////////////////////////////////
} // namespace grammars
} // namespace wave
} // namespace boost
} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS

View File

@@ -65,10 +65,10 @@ namespace grammars {
#define BOOST_WAVE_ENDREGION_ID 23
///////////////////////////////////////////////////////////////////////////////
//
//
// cpp_grammar_gen template class
//
// This template helps separating the compilation of the cpp_grammar
// This template helps separating the compilation of the cpp_grammar
// class from the compilation of the main pp_iterator. This is done to
// safe compilation time.
//
@@ -83,13 +83,13 @@ struct BOOST_WAVE_DECL cpp_grammar_gen
typedef typename token_type::position_type position_type;
typedef boost::spirit::classic::node_val_data_factory<
// boost::spirit::nil_t,
// boost::pool_allocator<boost::spirit::nil_t>
// boost::pool_allocator<boost::spirit::nil_t>
> node_factory_type;
// parse the cpp_grammar and return the resulting parse tree
static boost::spirit::classic::tree_parse_info<iterator_type, node_factory_type>
// parse the cpp_grammar and return the resulting parse tree
static boost::spirit::classic::tree_parse_info<iterator_type, node_factory_type>
parse_cpp_grammar (iterator_type const &first, iterator_type const &last,
position_type const &act_pos, bool &found_eof,
position_type const &act_pos, bool &found_eof,
token_type &found_directive, token_container_type &found_eoltokens);
};

View File

@@ -41,14 +41,14 @@
//
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace grammars {
///////////////////////////////////////////////////////////////////////////////
namespace closures {
struct intlit_closure
: boost::spirit::classic::closure<intlit_closure, uint_literal_type>
struct intlit_closure
: boost::spirit::classic::closure<intlit_closure, uint_literal_type>
{
member1 val;
};
@@ -65,10 +65,10 @@ struct intlit_grammar :
{
intlit_grammar(bool &is_unsigned_) : is_unsigned(is_unsigned_)
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "intlit_grammar",
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "intlit_grammar",
TRACE_INTLIT_GRAMMAR);
}
template <typename ScannerT>
struct definition
{
@@ -84,15 +84,15 @@ struct intlit_grammar :
{
using namespace boost::spirit::classic;
namespace phx = phoenix;
int_lit = (
sub_int_lit =
sub_int_lit =
( ch_p('0')[self.val = 0] >> (hex_lit | oct_lit)
| dec_lit
)
>> !as_lower_d[
(ch_p('u')[phx::var(self.is_unsigned) = true] || ch_p('l'))
(ch_p('u')[phx::var(self.is_unsigned) = true] || ch_p('l'))
| (ch_p('l') || ch_p('u')[phx::var(self.is_unsigned) = true])
]
,
@@ -105,7 +105,7 @@ struct intlit_grammar :
phx::var(self.is_unsigned) = true
]
,
oct_lit =
!uint_parser<uint_literal_type, 8>()
[
@@ -113,7 +113,7 @@ struct intlit_grammar :
phx::var(self.is_unsigned) = true
]
,
dec_lit =
uint_parser<uint_literal_type, 10>()
[
@@ -121,7 +121,7 @@ struct intlit_grammar :
]
)
;
BOOST_SPIRIT_DEBUG_TRACE_RULE(int_lit, TRACE_INTLIT_GRAMMAR);
BOOST_SPIRIT_DEBUG_TRACE_RULE(sub_int_lit, TRACE_INTLIT_GRAMMAR);
BOOST_SPIRIT_DEBUG_TRACE_RULE(hex_lit, TRACE_INTLIT_GRAMMAR);
@@ -133,33 +133,33 @@ struct intlit_grammar :
rule_t const& start() const
{ return int_lit; }
};
bool &is_unsigned;
};
#undef TRACE_INTLIT_GRAMMAR
///////////////////////////////////////////////////////////////////////////////
//
// The following function is defined here, to allow the separation of
//
// The following function is defined here, to allow the separation of
// the compilation of the intlit_grammar from the function using it.
//
//
///////////////////////////////////////////////////////////////////////////////
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_INTLITGRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_INTLITGRAMMAR_GEN_INLINE inline
#endif
#endif
template <typename TokenT>
BOOST_WAVE_INTLITGRAMMAR_GEN_INLINE
uint_literal_type
intlit_grammar_gen<TokenT>::evaluate(TokenT const &token,
BOOST_WAVE_INTLITGRAMMAR_GEN_INLINE
uint_literal_type
intlit_grammar_gen<TokenT>::evaluate(TokenT const &token,
bool &is_unsigned)
{
using namespace boost::spirit::classic;
intlit_grammar g(is_unsigned);
uint_literal_type result = 0;
typename TokenT::string_type const &token_val = token.get_value();
@@ -167,7 +167,7 @@ parse_info<typename TokenT::string_type::const_iterator> hit =
parse(token_val.begin(), token_val.end(), g[spirit_assign_actor(result)]);
if (!hit.hit) {
BOOST_WAVE_THROW(preprocess_exception, ill_formed_integer_literal,
BOOST_WAVE_THROW(preprocess_exception, ill_formed_integer_literal,
token_val.c_str(), token.get_position());
}
return result;

View File

@@ -31,11 +31,11 @@ namespace wave {
namespace grammars {
///////////////////////////////////////////////////////////////////////////////
//
//
// cpp_intlit_grammar_gen template class
//
// This template helps separating the compilation of the intlit_grammar
// class from the compilation of the expression_grammar. This is done
// This template helps separating the compilation of the intlit_grammar
// class from the compilation of the expression_grammar. This is done
// to safe compilation time.
//
///////////////////////////////////////////////////////////////////////////////
@@ -46,11 +46,11 @@ struct BOOST_WAVE_DECL intlit_grammar_gen {
};
///////////////////////////////////////////////////////////////////////////////
//
//
// cpp_chlit_grammar_gen template class
//
// This template helps separating the compilation of the chlit_grammar
// class from the compilation of the expression_grammar. This is done
// This template helps separating the compilation of the chlit_grammar
// class from the compilation of the expression_grammar. This is done
// to safe compilation time.
//
///////////////////////////////////////////////////////////////////////////////
@@ -62,7 +62,7 @@ struct BOOST_WAVE_DECL chlit_grammar_gen {
///////////////////////////////////////////////////////////////////////////////
} // namespace grammars
} // namespace wave
} // namespace wave
} // namespace boost
#ifdef BOOST_MSVC

View File

@@ -41,11 +41,11 @@ namespace grammars {
#define BOOST_WAVE_MACRO_DEFINITION_ID 7
///////////////////////////////////////////////////////////////////////////////
//
//
// predefined_macros_grammar_gen template class
//
// This template helps separating the compilation of the
// predefined_macros_grammar class from the compilation of the
// This template helps separating the compilation of the
// predefined_macros_grammar class from the compilation of the
// main pp_iterator. This is done to safe compilation time.
//
// This class helps parsing command line given macro definitions in a
@@ -58,8 +58,8 @@ struct BOOST_WAVE_DECL predefined_macros_grammar_gen
{
typedef LexIteratorT iterator_type;
// parse the cpp_grammar and return the resulting parse tree
static boost::spirit::classic::tree_parse_info<iterator_type>
// parse the cpp_grammar and return the resulting parse tree
static boost::spirit::classic::tree_parse_info<iterator_type>
parse_predefined_macro (iterator_type const &first, iterator_type const &last);
};

View File

@@ -39,7 +39,7 @@ namespace grammars {
///////////////////////////////////////////////////////////////////////////////
// Encapsulation of the grammar for command line driven predefined macros.
struct predefined_macros_grammar :
struct predefined_macros_grammar :
public boost::spirit::classic::grammar<predefined_macros_grammar>
{
template <typename ScannerT>
@@ -47,18 +47,18 @@ struct predefined_macros_grammar :
{
// 'normal' (parse_tree generating) rule type
typedef boost::spirit::classic::rule<
ScannerT, boost::spirit::classic::dynamic_parser_tag>
ScannerT, boost::spirit::classic::dynamic_parser_tag>
rule_type;
rule_type plain_define, macro_definition, macro_parameters;
definition(predefined_macros_grammar const &/*self*/)
definition(predefined_macros_grammar const &/*self*/)
{
// import the spirit and cpplexer namespaces here
using namespace boost::spirit::classic;
using namespace boost::wave;
using namespace boost::wave::util;
// set the rule id's for later use
plain_define.set_id(BOOST_WAVE_PLAIN_DEFINE_ID);
macro_parameters.set_id(BOOST_WAVE_MACRO_PARAMETERS_ID);
@@ -76,11 +76,11 @@ struct predefined_macros_grammar :
// make it possible to reuse the parse tree traversal code
plain_define
= ( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
| pattern_p(OperatorTokenType|AltExtTokenType,
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
| pattern_p(BoolLiteralTokenType,
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag) // true/false
)
>> !macro_parameters
@@ -93,16 +93,16 @@ struct predefined_macros_grammar :
no_node_d[ch_p(T_LEFTPAREN) >> *ch_p(T_SPACE)],
!list_p(
( ch_p(T_IDENTIFIER)
| pattern_p(KeywordTokenType,
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
| pattern_p(OperatorTokenType|AltExtTokenType,
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
| pattern_p(BoolLiteralTokenType,
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag) // true/false
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
| ch_p(T_ELLIPSIS)
#endif
),
),
no_node_d
[
*ch_p(T_SPACE) >> ch_p(T_COMMA) >> *ch_p(T_SPACE)
@@ -128,10 +128,10 @@ struct predefined_macros_grammar :
{ return plain_define; }
};
predefined_macros_grammar()
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this,
"predefined_macros_grammar", TRACE_PREDEF_MACROS_GRAMMAR);
predefined_macros_grammar()
{
BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this,
"predefined_macros_grammar", TRACE_PREDEF_MACROS_GRAMMAR);
}
};
@@ -140,21 +140,21 @@ struct predefined_macros_grammar :
#undef TRACE_PREDEF_MACROS_GRAMMAR
///////////////////////////////////////////////////////////////////////////////
//
// The following parse function is defined here, to allow the separation of
// the compilation of the cpp_predefined_macros_grammar from the function
//
// The following parse function is defined here, to allow the separation of
// the compilation of the cpp_predefined_macros_grammar from the function
// using it.
//
//
///////////////////////////////////////////////////////////////////////////////
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_PREDEF_MACROS_GRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_PREDEF_MACROS_GRAMMAR_GEN_INLINE inline
#endif
#endif
template <typename LexIteratorT>
BOOST_WAVE_PREDEF_MACROS_GRAMMAR_GEN_INLINE
BOOST_WAVE_PREDEF_MACROS_GRAMMAR_GEN_INLINE
boost::spirit::classic::tree_parse_info<LexIteratorT>
predefined_macros_grammar_gen<LexIteratorT>::parse_predefined_macro (
LexIteratorT const &first, LexIteratorT const &last)

View File

@@ -27,7 +27,7 @@ namespace grammars {
//
// value_error enum type
//
// This is used to encode any error occurred during the evaluation of a
// This is used to encode any error occurred during the evaluation of a
// conditional preprocessor expression
//
///////////////////////////////////////////////////////////////////////////////
@@ -37,10 +37,10 @@ enum value_error {
error_integer_overflow = 0x2,
error_character_overflow = 0x4
};
///////////////////////////////////////////////////////////////////////////////
} // namespace grammars
} // namespace wave
} // namespace wave
} // namespace boost
// the suffix header occurs after all of the code