Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2008-03-07 14:51:33


Author: hkaiser
Date: 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
New Revision: 43540
URL: http://svn.boost.org/trac/boost/changeset/43540

Log:
Wave: Started to add testing of preprocessor hooks.
Added:
   trunk/libs/wave/test/testwave/collect_hooks_information.hpp (contents, props changed)
Text files modified:
   trunk/boost/wave/util/cpp_iterator.hpp | 38 +
   trunk/libs/wave/ChangeLog | 5
   trunk/libs/wave/src/cpplexer/re2clex/cpp.re | 840 ++++++++++++++++++++--------------------
   trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re | 840 ++++++++++++++++++++--------------------
   trunk/libs/wave/test/testwave/testfiles/t_1_001.cpp | 16
   trunk/libs/wave/test/testwave/testfiles/t_1_002.cpp | 9
   trunk/libs/wave/test/testwave/testfiles/t_1_003.cpp | 31 +
   trunk/libs/wave/test/testwave/testfiles/t_1_004.cpp | 56 ++
   trunk/libs/wave/test/testwave/testfiles/t_1_005.cpp | 10
   trunk/libs/wave/test/testwave/testfiles/t_1_006.cpp | 30 +
   trunk/libs/wave/test/testwave/testfiles/t_1_007.cpp | 29 +
   trunk/libs/wave/test/testwave/testfiles/t_1_008.cpp | 105 +++++
   trunk/libs/wave/test/testwave/testfiles/t_1_009.cpp | 10
   trunk/libs/wave/test/testwave/testfiles/t_1_010.cpp | 10
   trunk/libs/wave/test/testwave/testfiles/t_1_011.cpp | 13
   trunk/libs/wave/test/testwave/testfiles/t_1_012.cpp | 27 +
   trunk/libs/wave/test/testwave/testfiles/t_1_013.cpp | 53 ++
   trunk/libs/wave/test/testwave/testfiles/t_1_014.cpp | 2
   trunk/libs/wave/test/testwave/testfiles/t_1_015.cpp | 9
   trunk/libs/wave/test/testwave/testfiles/t_1_016.cpp | 11
   trunk/libs/wave/test/testwave/testfiles/t_1_020.cpp | 12
   trunk/libs/wave/test/testwave/testfiles/t_1_021.cpp | 21 +
   trunk/libs/wave/test/testwave/testfiles/t_1_022.cpp | 12
   trunk/libs/wave/test/testwave/testfiles/t_1_023.cpp | 13
   trunk/libs/wave/test/testwave/testfiles/t_1_025.cpp | 15
   trunk/libs/wave/test/testwave/testfiles/t_1_026.cpp | 3
   trunk/libs/wave/test/testwave/testfiles/t_1_029.cpp | 21 +
   trunk/libs/wave/test/testwave/testfiles/t_1_030.cpp | 16
   trunk/libs/wave/test/testwave/testfiles/t_1_031.cpp | 9
   trunk/libs/wave/test/testwave/testfiles/t_1_033.cpp | 15
   trunk/libs/wave/test/testwave/testfiles/t_1_034.cpp | 16
   trunk/libs/wave/test/testwave/testfiles/t_1_035.cpp | 23 +
   trunk/libs/wave/test/testwave/testfiles/t_1_036.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_1_037.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_1_038.cpp | 5
   trunk/libs/wave/test/testwave/testfiles/t_2_001.cpp | 14
   trunk/libs/wave/test/testwave/testfiles/t_2_002.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_2_003.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_2_004.cpp | 16
   trunk/libs/wave/test/testwave/testfiles/t_2_005.cpp | 2
   trunk/libs/wave/test/testwave/testfiles/t_2_006.cpp | 13
   trunk/libs/wave/test/testwave/testfiles/t_2_007.cpp | 12
   trunk/libs/wave/test/testwave/testfiles/t_2_008.cpp | 11
   trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp | 33 +
   trunk/libs/wave/test/testwave/testfiles/t_2_010.cpp | 8
   trunk/libs/wave/test/testwave/testfiles/t_2_011.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_2_012.cpp | 3
   trunk/libs/wave/test/testwave/testfiles/t_2_013.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_2_014.cpp | 28 +
   trunk/libs/wave/test/testwave/testfiles/t_2_015.cpp | 11
   trunk/libs/wave/test/testwave/testfiles/t_2_016.cpp | 7
   trunk/libs/wave/test/testwave/testfiles/t_2_017.cpp | 12
   trunk/libs/wave/test/testwave/testfiles/t_3_001.cpp | 3
   trunk/libs/wave/test/testwave/testfiles/t_3_002.cpp | 19
   trunk/libs/wave/test/testwave/testfiles/t_3_003.cpp | 22 +
   trunk/libs/wave/test/testwave/testfiles/t_3_004.cpp | 25 +
   trunk/libs/wave/test/testwave/testfiles/t_4_001.cpp | 4
   trunk/libs/wave/test/testwave/testfiles/t_4_002.cpp | 9
   trunk/libs/wave/test/testwave/testfiles/t_4_004.cpp | 26 +
   trunk/libs/wave/test/testwave/testfiles/t_5_030.cpp | 4
   trunk/libs/wave/test/testwave/testfiles/t_6_063.cpp | 5
   trunk/libs/wave/test/testwave/testfiles/t_6_067.cpp | 5
   trunk/libs/wave/test/testwave/testfiles/t_9_001.cpp | 3
   trunk/libs/wave/test/testwave/testfiles/t_9_002.cpp | 3
   trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp | 15
   trunk/libs/wave/test/testwave/testfiles/t_9_004.cpp | 7
   trunk/libs/wave/test/testwave/testfiles/t_9_006.cpp | 8
   trunk/libs/wave/test/testwave/testfiles/t_9_007.cpp | 5
   trunk/libs/wave/test/testwave/testfiles/t_9_008.cpp | 5
   trunk/libs/wave/test/testwave/testfiles/t_9_009.cpp | 11
   trunk/libs/wave/test/testwave/testfiles/t_9_010.cpp | 41 +
   trunk/libs/wave/test/testwave/testfiles/t_9_011.cpp | 11
   trunk/libs/wave/test/testwave/testfiles/t_9_012.cpp | 6
   trunk/libs/wave/test/testwave/testfiles/t_9_013.cpp | 4
   trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp | 22 +
   trunk/libs/wave/test/testwave/testfiles/t_9_017.cpp | 27 +
   trunk/libs/wave/test/testwave/testfiles/t_9_018.cpp | 5
   trunk/libs/wave/test/testwave/testfiles/t_9_019.cpp | 6
   trunk/libs/wave/test/testwave/testwave.cpp | 2
   trunk/libs/wave/test/testwave/testwave_app.cpp | 196 +++++---
   trunk/libs/wave/test/testwave/testwave_app.hpp | 14
   trunk/tools/wave/cpp.cpp | 6
   82 files changed, 2092 insertions(+), 958 deletions(-)

Modified: trunk/boost/wave/util/cpp_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_iterator.hpp (original)
+++ trunk/boost/wave/util/cpp_iterator.hpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -65,7 +65,8 @@
>
 inline bool
 retrieve_macroname(ContextT& ctx, ParseNodeT const &node,
- boost::spirit::parser_id id, TokenT &macroname, PositionT const &act_pos)
+ boost::spirit::parser_id id, TokenT &macroname, PositionT& act_pos,
+ bool update_position)
 {
 ParseNodeT const *name_node = 0;
 
@@ -91,16 +92,20 @@
 
 // retrieve the macro name
     macroname = *children.front().value.begin();
+ if (update_position) {
+ macroname.set_position(act_pos);
+ act_pos.set_column(act_pos.get_column() + macroname.get_value().size());
+ }
     return true;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // retrieve the macro parameters or the macro definition from the parse tree
-template <typename ParseNodeT, typename TokenT, typename ContainerT>
+template <typename ParseNodeT, typename ContainerT, typename PositionT>
 inline bool
 retrieve_macrodefinition(
     ParseNodeT const &node, boost::spirit::parser_id id,
- ContainerT &macrodefinition, TokenT const &/*t*/)
+ ContainerT &macrodefinition, PositionT& act_pos, bool update_position)
 {
     using namespace boost::wave;
     typedef typename ParseNodeT::const_tree_iterator const_tree_iterator;
@@ -125,11 +130,21 @@
                 {
                     last_nonwhite = inserted;
                 }
+
+ if (update_position) {
+ (*inserted).set_position(act_pos);
+ act_pos.set_column(
+ act_pos.get_column() + (*inserted).get_value().size());
+ }
             }
         }
         
     // trim trailing whitespace (leading whitespace is trimmed by the grammar)
         if (last_nonwhite != macrodefinition.end()) {
+ if (update_position) {
+ act_pos.set_column((*last_nonwhite).get_position().get_column() +
+ (*last_nonwhite).get_value().size());
+ }
             macrodefinition.erase(++last_nonwhite, macrodefinition.end());
         }
         return true;
@@ -161,7 +176,7 @@
         ++begin;
         
 // parse the macro definition
-position_type act_pos("<command line>", 0);
+position_type act_pos("<command line>");
 boost::spirit::tree_parse_info<lexer_type> hit =
     predef_macros_type::parse_predefined_macro(
         lexer_type(begin, end, position_type(), language), lexer_type());
@@ -171,7 +186,7 @@
             macrostring.c_str(), act_pos);
         return false;
     }
-
+
 // retrieve the macro definition from the parse tree
 token_type macroname;
 std::vector<token_type> macroparameters;
@@ -179,12 +194,12 @@
 bool has_parameters = false;
 
     if (!boost::wave::util::retrieve_macroname(ctx, *hit.trees.begin(),
- BOOST_WAVE_PLAIN_DEFINE_ID, macroname, act_pos))
+ BOOST_WAVE_PLAIN_DEFINE_ID, macroname, act_pos, true))
         return false;
     has_parameters = boost::wave::util::retrieve_macrodefinition(*hit.trees.begin(),
- BOOST_WAVE_MACRO_PARAMETERS_ID, macroparameters, token_type());
+ BOOST_WAVE_MACRO_PARAMETERS_ID, macroparameters, act_pos, true);
     boost::wave::util::retrieve_macrodefinition(*hit.trees.begin(),
- BOOST_WAVE_MACRO_DEFINITION_ID, macrodefinition, token_type());
+ BOOST_WAVE_MACRO_DEFINITION_ID, macrodefinition, act_pos, true);
 
 // If no macrodefinition is given, and the macro string does not end with a
 // '=', then the macro should be defined with the value '1'
@@ -1415,14 +1430,15 @@
 std::vector<result_type> macroparameters;
 token_sequence_type macrodefinition;
 bool has_parameters = false;
+position_type pos(act_token.get_position());
 
     if (!boost::wave::util::retrieve_macroname(ctx, node,
- BOOST_WAVE_PLAIN_DEFINE_ID, macroname, act_token.get_position()))
+ BOOST_WAVE_PLAIN_DEFINE_ID, macroname, pos, false))
         return;
     has_parameters = boost::wave::util::retrieve_macrodefinition(node,
- BOOST_WAVE_MACRO_PARAMETERS_ID, macroparameters, act_token);
+ BOOST_WAVE_MACRO_PARAMETERS_ID, macroparameters, pos, false);
     boost::wave::util::retrieve_macrodefinition(node,
- BOOST_WAVE_MACRO_DEFINITION_ID, macrodefinition, act_token);
+ BOOST_WAVE_MACRO_DEFINITION_ID, macrodefinition, pos, false);
 
     if (has_parameters) {
 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0

Modified: trunk/libs/wave/ChangeLog
==============================================================================
--- trunk/libs/wave/ChangeLog (original)
+++ trunk/libs/wave/ChangeLog 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -169,7 +169,10 @@
   unconditionally between two operators even if one of these was a comma.
 - Fixed #line directive after a macro invocation containing newlines to
   correctly reference the line number.
-
+- Positions of macros defined on the command line now get properly reported as
+ "<command line>":1:...
+- Added testing of the preprocessor hooks.
+
 Boost V1.34.0
 - Wave Version 1.2.4
 - Added the possibility to explicitly enable/disable the generation of #line

Modified: trunk/libs/wave/src/cpplexer/re2clex/cpp.re
==============================================================================
--- trunk/libs/wave/src/cpplexer/re2clex/cpp.re (original)
+++ trunk/libs/wave/src/cpplexer/re2clex/cpp.re 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -1,437 +1,437 @@
-/*=============================================================================
- Boost.Wave: A Standard compliant C++ preprocessor library
-
- Copyright (c) 2001 Daniel C. Nuffer
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+
+ Copyright (c) 2001 Daniel C. Nuffer
     Copyright (c) 2001-2008 Hartmut Kaiser.
- 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)
-
- This is a lexer conforming to the Standard with a few exceptions.
- So it does allow the '$' to be part of identifiers. If you need strict
- Standards conforming behaviour, please include the lexer definition
- provided in the file strict_cpp.re.
-
- TODO:
- handle errors better.
-=============================================================================*/
-
-/*!re2c
-re2c:indent:string = " ";
-any = [\t\v\f\r\n\040-\377];
-anyctrl = [\001-\037];
-OctalDigit = [0-7];
-Digit = [0-9];
-HexDigit = [a-fA-F0-9];
-Integer = (("0" [xX] HexDigit+) | ("0" OctalDigit*) | ([1-9] Digit*));
-ExponentStart = [Ee] [+-];
-ExponentPart = [Ee] [+-]? Digit+;
-FractionalConstant = (Digit* "." Digit+) | (Digit+ ".");
-FloatingSuffix = [fF] [lL]? | [lL] [fF]?;
-IntegerSuffix = [uU] [lL]? | [lL] [uU]?;
-LongIntegerSuffix = [uU] ([lL] [lL]) | ([lL] [lL]) [uU]?;
-Backslash = [\\] | "??/";
-EscapeSequence = Backslash ([abfnrtv?'"] | Backslash | "x" HexDigit+ | OctalDigit OctalDigit? OctalDigit?);
-HexQuad = HexDigit HexDigit HexDigit HexDigit;
-UniversalChar = Backslash ("u" HexQuad | "U" HexQuad HexQuad);
-Newline = "\r\n" | "\n" | "\r";
-PPSpace = ([ \t\f\v]|("/*"(any\[*]|Newline|("*"+(any\[*/]|Newline)))*"*"+"/"))*;
-Pound = "#" | "??=" | "%:";
-NonDigit = [a-zA-Z_$] | UniversalChar;
-*/
-
-/*!re2c
- "/*" { goto ccomment; }
- "//" { goto cppcomment; }
- "."? Digit { goto pp_number; }
-
- "asm" { BOOST_WAVE_RET(T_ASM); }
- "auto" { BOOST_WAVE_RET(T_AUTO); }
- "bool" { BOOST_WAVE_RET(T_BOOL); }
- "break" { BOOST_WAVE_RET(T_BREAK); }
- "case" { BOOST_WAVE_RET(T_CASE); }
- "catch" { BOOST_WAVE_RET(T_CATCH); }
- "char" { BOOST_WAVE_RET(T_CHAR); }
- "class" { BOOST_WAVE_RET(T_CLASS); }
- "const" { BOOST_WAVE_RET(T_CONST); }
- "const_cast" { BOOST_WAVE_RET(T_CONSTCAST); }
- "continue" { BOOST_WAVE_RET(T_CONTINUE); }
- "default" { BOOST_WAVE_RET(T_DEFAULT); }
- "delete" { BOOST_WAVE_RET(T_DELETE); }
- "do" { BOOST_WAVE_RET(T_DO); }
- "double" { BOOST_WAVE_RET(T_DOUBLE); }
- "dynamic_cast" { BOOST_WAVE_RET(T_DYNAMICCAST); }
- "else" { BOOST_WAVE_RET(T_ELSE); }
- "enum" { BOOST_WAVE_RET(T_ENUM); }
- "explicit" { BOOST_WAVE_RET(T_EXPLICIT); }
- "export" { BOOST_WAVE_RET(T_EXPORT); }
- "extern" { BOOST_WAVE_RET(T_EXTERN); }
- "false" { BOOST_WAVE_RET(T_FALSE); }
- "float" { BOOST_WAVE_RET(T_FLOAT); }
- "for" { BOOST_WAVE_RET(T_FOR); }
- "friend" { BOOST_WAVE_RET(T_FRIEND); }
- "goto" { BOOST_WAVE_RET(T_GOTO); }
- "if" { BOOST_WAVE_RET(T_IF); }
- "import" { BOOST_WAVE_RET(s->enable_import_keyword ? T_IMPORT : T_IDENTIFIER); }
- "inline" { BOOST_WAVE_RET(T_INLINE); }
- "int" { BOOST_WAVE_RET(T_INT); }
- "long" { BOOST_WAVE_RET(T_LONG); }
- "mutable" { BOOST_WAVE_RET(T_MUTABLE); }
- "namespace" { BOOST_WAVE_RET(T_NAMESPACE); }
- "new" { BOOST_WAVE_RET(T_NEW); }
- "operator" { BOOST_WAVE_RET(T_OPERATOR); }
- "private" { BOOST_WAVE_RET(T_PRIVATE); }
- "protected" { BOOST_WAVE_RET(T_PROTECTED); }
- "public" { BOOST_WAVE_RET(T_PUBLIC); }
- "register" { BOOST_WAVE_RET(T_REGISTER); }
- "reinterpret_cast" { BOOST_WAVE_RET(T_REINTERPRETCAST); }
- "return" { BOOST_WAVE_RET(T_RETURN); }
- "short" { BOOST_WAVE_RET(T_SHORT); }
- "signed" { BOOST_WAVE_RET(T_SIGNED); }
- "sizeof" { BOOST_WAVE_RET(T_SIZEOF); }
- "static" { BOOST_WAVE_RET(T_STATIC); }
- "static_cast" { BOOST_WAVE_RET(T_STATICCAST); }
- "struct" { BOOST_WAVE_RET(T_STRUCT); }
- "switch" { BOOST_WAVE_RET(T_SWITCH); }
- "template" { BOOST_WAVE_RET(T_TEMPLATE); }
- "this" { BOOST_WAVE_RET(T_THIS); }
- "throw" { BOOST_WAVE_RET(T_THROW); }
- "true" { BOOST_WAVE_RET(T_TRUE); }
- "try" { BOOST_WAVE_RET(T_TRY); }
- "typedef" { BOOST_WAVE_RET(T_TYPEDEF); }
- "typeid" { BOOST_WAVE_RET(T_TYPEID); }
- "typename" { BOOST_WAVE_RET(T_TYPENAME); }
- "union" { BOOST_WAVE_RET(T_UNION); }
- "unsigned" { BOOST_WAVE_RET(T_UNSIGNED); }
- "using" { BOOST_WAVE_RET(T_USING); }
- "virtual" { BOOST_WAVE_RET(T_VIRTUAL); }
- "void" { BOOST_WAVE_RET(T_VOID); }
- "volatile" { BOOST_WAVE_RET(T_VOLATILE); }
- "wchar_t" { BOOST_WAVE_RET(T_WCHART); }
- "while" { BOOST_WAVE_RET(T_WHILE); }
-
- "__int8" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT8 : T_IDENTIFIER); }
- "__int16" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT16 : T_IDENTIFIER); }
- "__int32" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT32 : T_IDENTIFIER); }
- "__int64" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT64 : T_IDENTIFIER); }
- "_"? "_based" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_BASED : T_IDENTIFIER); }
- "_"? "_declspec" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_DECLSPEC : T_IDENTIFIER); }
- "_"? "_cdecl" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_CDECL : T_IDENTIFIER); }
- "_"? "_fastcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FASTCALL : T_IDENTIFIER); }
- "_"? "_stdcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_STDCALL : T_IDENTIFIER); }
- "__try" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_TRY : T_IDENTIFIER); }
- "__except" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_EXCEPT : T_IDENTIFIER); }
- "__finally" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FINALLY : T_IDENTIFIER); }
- "__leave" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_LEAVE : T_IDENTIFIER); }
- "_"? "_inline" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INLINE : T_IDENTIFIER); }
- "_"? "_asm" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_ASM : T_IDENTIFIER); }
-
- "{" { BOOST_WAVE_RET(T_LEFTBRACE); }
- "??<" { BOOST_WAVE_RET(T_LEFTBRACE_TRIGRAPH); }
- "<%" { BOOST_WAVE_RET(T_LEFTBRACE_ALT); }
- "}" { BOOST_WAVE_RET(T_RIGHTBRACE); }
- "??>" { BOOST_WAVE_RET(T_RIGHTBRACE_TRIGRAPH); }
- "%>" { BOOST_WAVE_RET(T_RIGHTBRACE_ALT); }
- "[" { BOOST_WAVE_RET(T_LEFTBRACKET); }
- "??(" { BOOST_WAVE_RET(T_LEFTBRACKET_TRIGRAPH); }
- "<:" { BOOST_WAVE_RET(T_LEFTBRACKET_ALT); }
- "]" { BOOST_WAVE_RET(T_RIGHTBRACKET); }
- "??)" { BOOST_WAVE_RET(T_RIGHTBRACKET_TRIGRAPH); }
- ":>" { BOOST_WAVE_RET(T_RIGHTBRACKET_ALT); }
- "#" { BOOST_WAVE_RET(T_POUND); }
- "%:" { BOOST_WAVE_RET(T_POUND_ALT); }
- "??=" { BOOST_WAVE_RET(T_POUND_TRIGRAPH); }
- "##" { BOOST_WAVE_RET(T_POUND_POUND); }
- "#??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
- "??=#" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
- "??=??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
- "%:%:" { BOOST_WAVE_RET(T_POUND_POUND_ALT); }
- "(" { BOOST_WAVE_RET(T_LEFTPAREN); }
- ")" { BOOST_WAVE_RET(T_RIGHTPAREN); }
- ";" { BOOST_WAVE_RET(T_SEMICOLON); }
- ":" { BOOST_WAVE_RET(T_COLON); }
- "..." { BOOST_WAVE_RET(T_ELLIPSIS); }
- "?" { BOOST_WAVE_RET(T_QUESTION_MARK); }
- "::"
- {
- if (s->act_in_c99_mode) {
- --YYCURSOR;
- BOOST_WAVE_RET(T_COLON);
- }
- else {
- BOOST_WAVE_RET(T_COLON_COLON);
- }
- }
- "." { BOOST_WAVE_RET(T_DOT); }
- ".*"
- {
- if (s->act_in_c99_mode) {
- --YYCURSOR;
- BOOST_WAVE_RET(T_DOT);
- }
- else {
- BOOST_WAVE_RET(T_DOTSTAR);
- }
- }
- "+" { BOOST_WAVE_RET(T_PLUS); }
- "-" { BOOST_WAVE_RET(T_MINUS); }
- "*" { BOOST_WAVE_RET(T_STAR); }
- "/" { BOOST_WAVE_RET(T_DIVIDE); }
- "%" { BOOST_WAVE_RET(T_PERCENT); }
- "^" { BOOST_WAVE_RET(T_XOR); }
- "??'" { BOOST_WAVE_RET(T_XOR_TRIGRAPH); }
- "xor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XOR_ALT); }
- "&" { BOOST_WAVE_RET(T_AND); }
- "bitand" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_AND_ALT); }
- "|" { BOOST_WAVE_RET(T_OR); }
- "bitor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OR_ALT); }
- "??!" { BOOST_WAVE_RET(T_OR_TRIGRAPH); }
- "~" { BOOST_WAVE_RET(T_COMPL); }
- "??-" { BOOST_WAVE_RET(T_COMPL_TRIGRAPH); }
- "compl" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_COMPL_ALT); }
- "!" { BOOST_WAVE_RET(T_NOT); }
- "not" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOT_ALT); }
- "=" { BOOST_WAVE_RET(T_ASSIGN); }
- "<" { BOOST_WAVE_RET(T_LESS); }
- ">" { BOOST_WAVE_RET(T_GREATER); }
- "+=" { BOOST_WAVE_RET(T_PLUSASSIGN); }
- "-=" { BOOST_WAVE_RET(T_MINUSASSIGN); }
- "*=" { BOOST_WAVE_RET(T_STARASSIGN); }
- "/=" { BOOST_WAVE_RET(T_DIVIDEASSIGN); }
- "%=" { BOOST_WAVE_RET(T_PERCENTASSIGN); }
- "^=" { BOOST_WAVE_RET(T_XORASSIGN); }
- "xor_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XORASSIGN_ALT); }
- "??'=" { BOOST_WAVE_RET(T_XORASSIGN_TRIGRAPH); }
- "&=" { BOOST_WAVE_RET(T_ANDASSIGN); }
- "and_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDASSIGN_ALT); }
- "|=" { BOOST_WAVE_RET(T_ORASSIGN); }
- "or_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ORASSIGN_ALT); }
- "??!=" { BOOST_WAVE_RET(T_ORASSIGN_TRIGRAPH); }
- "<<" { BOOST_WAVE_RET(T_SHIFTLEFT); }
- ">>" { BOOST_WAVE_RET(T_SHIFTRIGHT); }
- ">>=" { BOOST_WAVE_RET(T_SHIFTRIGHTASSIGN); }
- "<<=" { BOOST_WAVE_RET(T_SHIFTLEFTASSIGN); }
- "==" { BOOST_WAVE_RET(T_EQUAL); }
- "!=" { BOOST_WAVE_RET(T_NOTEQUAL); }
- "not_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOTEQUAL_ALT); }
- "<=" { BOOST_WAVE_RET(T_LESSEQUAL); }
- ">=" { BOOST_WAVE_RET(T_GREATEREQUAL); }
- "&&" { BOOST_WAVE_RET(T_ANDAND); }
- "and" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDAND_ALT); }
- "||" { BOOST_WAVE_RET(T_OROR); }
- "??!|" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
- "|??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
- "or" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); }
- "??!??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
- "++" { BOOST_WAVE_RET(T_PLUSPLUS); }
- "--" { BOOST_WAVE_RET(T_MINUSMINUS); }
- "," { BOOST_WAVE_RET(T_COMMA); }
- "->*"
- {
- if (s->act_in_c99_mode) {
- --YYCURSOR;
- BOOST_WAVE_RET(T_ARROW);
- }
- else {
- BOOST_WAVE_RET(T_ARROWSTAR);
- }
- }
- "->" { BOOST_WAVE_RET(T_ARROW); }
- "??/" { BOOST_WAVE_RET(T_ANY_TRIGRAPH); }
-
-
- ([a-zA-Z_$] | UniversalChar) ([a-zA-Z_0-9$] | UniversalChar)*
- { BOOST_WAVE_RET(T_IDENTIFIER); }
-
- "L"? (['] (EscapeSequence|any\[\n\r\\']|UniversalChar)+ ['])
- { BOOST_WAVE_RET(T_CHARLIT); }
-
- "L"? (["] (EscapeSequence|any\[\n\r\\"]|UniversalChar)* ["])
- { BOOST_WAVE_RET(T_STRINGLIT); }
-
-
- Pound PPSpace ( "include" | "include_next") PPSpace "<" (any\[\n\r>])+ ">"
- { BOOST_WAVE_RET(T_PP_HHEADER); }
-
- Pound PPSpace ( "include" | "include_next") PPSpace "\"" (any\[\n\r"])+ "\""
- { BOOST_WAVE_RET(T_PP_QHEADER); }
-
- Pound PPSpace ( "include" | "include_next") PPSpace
- { BOOST_WAVE_RET(T_PP_INCLUDE); }
-
- Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
- Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
- Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
- Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
- Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
- Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
- Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
- Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
- Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
- Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
- Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
-
- Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
-
- Pound PPSpace "region" { BOOST_WAVE_RET(T_MSEXT_PP_REGION); }
- Pound PPSpace "endregion" { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); }
-
- [ \t\v\f]+
- { BOOST_WAVE_RET(T_SPACE); }
-
- Newline
- {
- s->line++;
- cursor.column = 1;
- BOOST_WAVE_RET(T_NEWLINE);
- }
-
- "\000"
- {
- if (s->eof && cursor != s->eof)
- {
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ 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)
+
+ This is a lexer conforming to the Standard with a few exceptions.
+ So it does allow the '$' to be part of identifiers. If you need strict
+ Standards conforming behaviour, please include the lexer definition
+ provided in the file strict_cpp.re.
+
+ TODO:
+ handle errors better.
+=============================================================================*/
+
+/*!re2c
+re2c:indent:string = " ";
+any = [\t\v\f\r\n\040-\377];
+anyctrl = [\001-\037];
+OctalDigit = [0-7];
+Digit = [0-9];
+HexDigit = [a-fA-F0-9];
+Integer = (("0" [xX] HexDigit+) | ("0" OctalDigit*) | ([1-9] Digit*));
+ExponentStart = [Ee] [+-];
+ExponentPart = [Ee] [+-]? Digit+;
+FractionalConstant = (Digit* "." Digit+) | (Digit+ ".");
+FloatingSuffix = [fF] [lL]? | [lL] [fF]?;
+IntegerSuffix = [uU] [lL]? | [lL] [uU]?;
+LongIntegerSuffix = [uU] ([lL] [lL]) | ([lL] [lL]) [uU]?;
+Backslash = [\\] | "??/";
+EscapeSequence = Backslash ([abfnrtv?'"] | Backslash | "x" HexDigit+ | OctalDigit OctalDigit? OctalDigit?);
+HexQuad = HexDigit HexDigit HexDigit HexDigit;
+UniversalChar = Backslash ("u" HexQuad | "U" HexQuad HexQuad);
+Newline = "\r\n" | "\n" | "\r";
+PPSpace = ([ \t\f\v]|("/*"(any\[*]|Newline|("*"+(any\[*/]|Newline)))*"*"+"/"))*;
+Pound = "#" | "??=" | "%:";
+NonDigit = [a-zA-Z_$] | UniversalChar;
+*/
+
+/*!re2c
+ "/*" { goto ccomment; }
+ "//" { goto cppcomment; }
+ "."? Digit { goto pp_number; }
+
+ "asm" { BOOST_WAVE_RET(T_ASM); }
+ "auto" { BOOST_WAVE_RET(T_AUTO); }
+ "bool" { BOOST_WAVE_RET(T_BOOL); }
+ "break" { BOOST_WAVE_RET(T_BREAK); }
+ "case" { BOOST_WAVE_RET(T_CASE); }
+ "catch" { BOOST_WAVE_RET(T_CATCH); }
+ "char" { BOOST_WAVE_RET(T_CHAR); }
+ "class" { BOOST_WAVE_RET(T_CLASS); }
+ "const" { BOOST_WAVE_RET(T_CONST); }
+ "const_cast" { BOOST_WAVE_RET(T_CONSTCAST); }
+ "continue" { BOOST_WAVE_RET(T_CONTINUE); }
+ "default" { BOOST_WAVE_RET(T_DEFAULT); }
+ "delete" { BOOST_WAVE_RET(T_DELETE); }
+ "do" { BOOST_WAVE_RET(T_DO); }
+ "double" { BOOST_WAVE_RET(T_DOUBLE); }
+ "dynamic_cast" { BOOST_WAVE_RET(T_DYNAMICCAST); }
+ "else" { BOOST_WAVE_RET(T_ELSE); }
+ "enum" { BOOST_WAVE_RET(T_ENUM); }
+ "explicit" { BOOST_WAVE_RET(T_EXPLICIT); }
+ "export" { BOOST_WAVE_RET(T_EXPORT); }
+ "extern" { BOOST_WAVE_RET(T_EXTERN); }
+ "false" { BOOST_WAVE_RET(T_FALSE); }
+ "float" { BOOST_WAVE_RET(T_FLOAT); }
+ "for" { BOOST_WAVE_RET(T_FOR); }
+ "friend" { BOOST_WAVE_RET(T_FRIEND); }
+ "goto" { BOOST_WAVE_RET(T_GOTO); }
+ "if" { BOOST_WAVE_RET(T_IF); }
+ "import" { BOOST_WAVE_RET(s->enable_import_keyword ? T_IMPORT : T_IDENTIFIER); }
+ "inline" { BOOST_WAVE_RET(T_INLINE); }
+ "int" { BOOST_WAVE_RET(T_INT); }
+ "long" { BOOST_WAVE_RET(T_LONG); }
+ "mutable" { BOOST_WAVE_RET(T_MUTABLE); }
+ "namespace" { BOOST_WAVE_RET(T_NAMESPACE); }
+ "new" { BOOST_WAVE_RET(T_NEW); }
+ "operator" { BOOST_WAVE_RET(T_OPERATOR); }
+ "private" { BOOST_WAVE_RET(T_PRIVATE); }
+ "protected" { BOOST_WAVE_RET(T_PROTECTED); }
+ "public" { BOOST_WAVE_RET(T_PUBLIC); }
+ "register" { BOOST_WAVE_RET(T_REGISTER); }
+ "reinterpret_cast" { BOOST_WAVE_RET(T_REINTERPRETCAST); }
+ "return" { BOOST_WAVE_RET(T_RETURN); }
+ "short" { BOOST_WAVE_RET(T_SHORT); }
+ "signed" { BOOST_WAVE_RET(T_SIGNED); }
+ "sizeof" { BOOST_WAVE_RET(T_SIZEOF); }
+ "static" { BOOST_WAVE_RET(T_STATIC); }
+ "static_cast" { BOOST_WAVE_RET(T_STATICCAST); }
+ "struct" { BOOST_WAVE_RET(T_STRUCT); }
+ "switch" { BOOST_WAVE_RET(T_SWITCH); }
+ "template" { BOOST_WAVE_RET(T_TEMPLATE); }
+ "this" { BOOST_WAVE_RET(T_THIS); }
+ "throw" { BOOST_WAVE_RET(T_THROW); }
+ "true" { BOOST_WAVE_RET(T_TRUE); }
+ "try" { BOOST_WAVE_RET(T_TRY); }
+ "typedef" { BOOST_WAVE_RET(T_TYPEDEF); }
+ "typeid" { BOOST_WAVE_RET(T_TYPEID); }
+ "typename" { BOOST_WAVE_RET(T_TYPENAME); }
+ "union" { BOOST_WAVE_RET(T_UNION); }
+ "unsigned" { BOOST_WAVE_RET(T_UNSIGNED); }
+ "using" { BOOST_WAVE_RET(T_USING); }
+ "virtual" { BOOST_WAVE_RET(T_VIRTUAL); }
+ "void" { BOOST_WAVE_RET(T_VOID); }
+ "volatile" { BOOST_WAVE_RET(T_VOLATILE); }
+ "wchar_t" { BOOST_WAVE_RET(T_WCHART); }
+ "while" { BOOST_WAVE_RET(T_WHILE); }
+
+ "__int8" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT8 : T_IDENTIFIER); }
+ "__int16" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT16 : T_IDENTIFIER); }
+ "__int32" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT32 : T_IDENTIFIER); }
+ "__int64" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT64 : T_IDENTIFIER); }
+ "_"? "_based" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_BASED : T_IDENTIFIER); }
+ "_"? "_declspec" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_DECLSPEC : T_IDENTIFIER); }
+ "_"? "_cdecl" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_CDECL : T_IDENTIFIER); }
+ "_"? "_fastcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FASTCALL : T_IDENTIFIER); }
+ "_"? "_stdcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_STDCALL : T_IDENTIFIER); }
+ "__try" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_TRY : T_IDENTIFIER); }
+ "__except" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_EXCEPT : T_IDENTIFIER); }
+ "__finally" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FINALLY : T_IDENTIFIER); }
+ "__leave" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_LEAVE : T_IDENTIFIER); }
+ "_"? "_inline" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INLINE : T_IDENTIFIER); }
+ "_"? "_asm" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_ASM : T_IDENTIFIER); }
+
+ "{" { BOOST_WAVE_RET(T_LEFTBRACE); }
+ "??<" { BOOST_WAVE_RET(T_LEFTBRACE_TRIGRAPH); }
+ "<%" { BOOST_WAVE_RET(T_LEFTBRACE_ALT); }
+ "}" { BOOST_WAVE_RET(T_RIGHTBRACE); }
+ "??>" { BOOST_WAVE_RET(T_RIGHTBRACE_TRIGRAPH); }
+ "%>" { BOOST_WAVE_RET(T_RIGHTBRACE_ALT); }
+ "[" { BOOST_WAVE_RET(T_LEFTBRACKET); }
+ "??(" { BOOST_WAVE_RET(T_LEFTBRACKET_TRIGRAPH); }
+ "<:" { BOOST_WAVE_RET(T_LEFTBRACKET_ALT); }
+ "]" { BOOST_WAVE_RET(T_RIGHTBRACKET); }
+ "??)" { BOOST_WAVE_RET(T_RIGHTBRACKET_TRIGRAPH); }
+ ":>" { BOOST_WAVE_RET(T_RIGHTBRACKET_ALT); }
+ "#" { BOOST_WAVE_RET(T_POUND); }
+ "%:" { BOOST_WAVE_RET(T_POUND_ALT); }
+ "??=" { BOOST_WAVE_RET(T_POUND_TRIGRAPH); }
+ "##" { BOOST_WAVE_RET(T_POUND_POUND); }
+ "#??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
+ "??=#" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
+ "??=??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
+ "%:%:" { BOOST_WAVE_RET(T_POUND_POUND_ALT); }
+ "(" { BOOST_WAVE_RET(T_LEFTPAREN); }
+ ")" { BOOST_WAVE_RET(T_RIGHTPAREN); }
+ ";" { BOOST_WAVE_RET(T_SEMICOLON); }
+ ":" { BOOST_WAVE_RET(T_COLON); }
+ "..." { BOOST_WAVE_RET(T_ELLIPSIS); }
+ "?" { BOOST_WAVE_RET(T_QUESTION_MARK); }
+ "::"
+ {
+ if (s->act_in_c99_mode) {
+ --YYCURSOR;
+ BOOST_WAVE_RET(T_COLON);
+ }
+ else {
+ BOOST_WAVE_RET(T_COLON_COLON);
+ }
+ }
+ "." { BOOST_WAVE_RET(T_DOT); }
+ ".*"
+ {
+ if (s->act_in_c99_mode) {
+ --YYCURSOR;
+ BOOST_WAVE_RET(T_DOT);
+ }
+ else {
+ BOOST_WAVE_RET(T_DOTSTAR);
+ }
+ }
+ "+" { BOOST_WAVE_RET(T_PLUS); }
+ "-" { BOOST_WAVE_RET(T_MINUS); }
+ "*" { BOOST_WAVE_RET(T_STAR); }
+ "/" { BOOST_WAVE_RET(T_DIVIDE); }
+ "%" { BOOST_WAVE_RET(T_PERCENT); }
+ "^" { BOOST_WAVE_RET(T_XOR); }
+ "??'" { BOOST_WAVE_RET(T_XOR_TRIGRAPH); }
+ "xor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XOR_ALT); }
+ "&" { BOOST_WAVE_RET(T_AND); }
+ "bitand" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_AND_ALT); }
+ "|" { BOOST_WAVE_RET(T_OR); }
+ "bitor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OR_ALT); }
+ "??!" { BOOST_WAVE_RET(T_OR_TRIGRAPH); }
+ "~" { BOOST_WAVE_RET(T_COMPL); }
+ "??-" { BOOST_WAVE_RET(T_COMPL_TRIGRAPH); }
+ "compl" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_COMPL_ALT); }
+ "!" { BOOST_WAVE_RET(T_NOT); }
+ "not" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOT_ALT); }
+ "=" { BOOST_WAVE_RET(T_ASSIGN); }
+ "<" { BOOST_WAVE_RET(T_LESS); }
+ ">" { BOOST_WAVE_RET(T_GREATER); }
+ "+=" { BOOST_WAVE_RET(T_PLUSASSIGN); }
+ "-=" { BOOST_WAVE_RET(T_MINUSASSIGN); }
+ "*=" { BOOST_WAVE_RET(T_STARASSIGN); }
+ "/=" { BOOST_WAVE_RET(T_DIVIDEASSIGN); }
+ "%=" { BOOST_WAVE_RET(T_PERCENTASSIGN); }
+ "^=" { BOOST_WAVE_RET(T_XORASSIGN); }
+ "xor_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XORASSIGN_ALT); }
+ "??'=" { BOOST_WAVE_RET(T_XORASSIGN_TRIGRAPH); }
+ "&=" { BOOST_WAVE_RET(T_ANDASSIGN); }
+ "and_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDASSIGN_ALT); }
+ "|=" { BOOST_WAVE_RET(T_ORASSIGN); }
+ "or_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ORASSIGN_ALT); }
+ "??!=" { BOOST_WAVE_RET(T_ORASSIGN_TRIGRAPH); }
+ "<<" { BOOST_WAVE_RET(T_SHIFTLEFT); }
+ ">>" { BOOST_WAVE_RET(T_SHIFTRIGHT); }
+ ">>=" { BOOST_WAVE_RET(T_SHIFTRIGHTASSIGN); }
+ "<<=" { BOOST_WAVE_RET(T_SHIFTLEFTASSIGN); }
+ "==" { BOOST_WAVE_RET(T_EQUAL); }
+ "!=" { BOOST_WAVE_RET(T_NOTEQUAL); }
+ "not_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOTEQUAL_ALT); }
+ "<=" { BOOST_WAVE_RET(T_LESSEQUAL); }
+ ">=" { BOOST_WAVE_RET(T_GREATEREQUAL); }
+ "&&" { BOOST_WAVE_RET(T_ANDAND); }
+ "and" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDAND_ALT); }
+ "||" { BOOST_WAVE_RET(T_OROR); }
+ "??!|" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
+ "|??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
+ "or" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); }
+ "??!??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
+ "++" { BOOST_WAVE_RET(T_PLUSPLUS); }
+ "--" { BOOST_WAVE_RET(T_MINUSMINUS); }
+ "," { BOOST_WAVE_RET(T_COMMA); }
+ "->*"
+ {
+ if (s->act_in_c99_mode) {
+ --YYCURSOR;
+ BOOST_WAVE_RET(T_ARROW);
+ }
+ else {
+ BOOST_WAVE_RET(T_ARROWSTAR);
+ }
+ }
+ "->" { BOOST_WAVE_RET(T_ARROW); }
+ "??/" { BOOST_WAVE_RET(T_ANY_TRIGRAPH); }
+
+
+ ([a-zA-Z_$] | UniversalChar) ([a-zA-Z_0-9$] | UniversalChar)*
+ { BOOST_WAVE_RET(T_IDENTIFIER); }
+
+ "L"? (['] (EscapeSequence|any\[\n\r\\']|UniversalChar)+ ['])
+ { BOOST_WAVE_RET(T_CHARLIT); }
+
+ "L"? (["] (EscapeSequence|any\[\n\r\\"]|UniversalChar)* ["])
+ { BOOST_WAVE_RET(T_STRINGLIT); }
+
+
+ Pound PPSpace ( "include" | "include_next") PPSpace "<" (any\[\n\r>])+ ">"
+ { BOOST_WAVE_RET(T_PP_HHEADER); }
+
+ Pound PPSpace ( "include" | "include_next") PPSpace "\"" (any\[\n\r"])+ "\""
+ { BOOST_WAVE_RET(T_PP_QHEADER); }
+
+ Pound PPSpace ( "include" | "include_next") PPSpace
+ { BOOST_WAVE_RET(T_PP_INCLUDE); }
+
+ Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
+ Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
+ Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
+ Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
+ Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
+ Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
+ Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
+ Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
+ Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
+ Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
+ Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
+
+ Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
+
+ Pound PPSpace "region" { BOOST_WAVE_RET(T_MSEXT_PP_REGION); }
+ Pound PPSpace "endregion" { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); }
+
+ [ \t\v\f]+
+ { BOOST_WAVE_RET(T_SPACE); }
+
+ Newline
+ {
+ s->line++;
+ cursor.column = 1;
+ BOOST_WAVE_RET(T_NEWLINE);
+ }
+
+ "\000"
+ {
+ if (s->eof && cursor != s->eof)
+ {
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_error,
                 "invalid character '\\000' in input stream");
- }
- BOOST_WAVE_RET(T_EOF);
- }
-
- any { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
-
- anyctrl
- {
- // flag the error
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ BOOST_WAVE_RET(T_EOF);
+ }
+
+ any { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
+
+ anyctrl
+ {
+ // flag the error
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
         (*s->error_proc)(s, lexing_exception::generic_lexing_error,
             "invalid character '\\%03o' in input stream", *--YYCURSOR);
- }
-*/
-
-ccomment:
-/*!re2c
- "*/" { BOOST_WAVE_RET(T_CCOMMENT); }
-
- Newline
- {
- /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
- /*s->tok = cursor; */
- s->line += count_backslash_newlines(s, cursor) +1;
- cursor.column = 1;
- goto ccomment;
- }
-
- any { goto ccomment; }
-
- "\000"
- {
- if(cursor == s->eof)
- {
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+*/
+
+ccomment:
+/*!re2c
+ "*/" { BOOST_WAVE_RET(T_CCOMMENT); }
+
+ Newline
+ {
+ /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
+ /*s->tok = cursor; */
+ s->line += count_backslash_newlines(s, cursor) +1;
+ cursor.column = 1;
+ goto ccomment;
+ }
+
+ any { goto ccomment; }
+
+ "\000"
+ {
+ if(cursor == s->eof)
+ {
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_warning,
                 "Unterminated 'C' style comment");
- }
- else
- {
- --YYCURSOR; // next call returns T_EOF
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ else
+ {
+ --YYCURSOR; // next call returns T_EOF
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_error,
                 "invalid character: '\\000' in input stream");
- }
- }
-
- anyctrl
- {
- // flag the error
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ }
+
+ anyctrl
+ {
+ // flag the error
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
         (*s->error_proc)(s, lexing_exception::generic_lexing_error,
             "invalid character '\\%03o' in input stream", *--YYCURSOR);
- }
-*/
-
-cppcomment:
-/*!re2c
- Newline
- {
- /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
- /*s->tok = cursor; */
- s->line++;
- cursor.column = 1;
- BOOST_WAVE_RET(T_CPPCOMMENT);
- }
-
- any { goto cppcomment; }
-
- "\000"
- {
- if (s->eof && cursor != s->eof)
- {
- --YYCURSOR; // next call returns T_EOF
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+*/
+
+cppcomment:
+/*!re2c
+ Newline
+ {
+ /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
+ /*s->tok = cursor; */
+ s->line++;
+ cursor.column = 1;
+ BOOST_WAVE_RET(T_CPPCOMMENT);
+ }
+
+ any { goto cppcomment; }
+
+ "\000"
+ {
+ if (s->eof && cursor != s->eof)
+ {
+ --YYCURSOR; // next call returns T_EOF
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_error,
                 "invalid character '\\000' in input stream");
- }
-
- --YYCURSOR; // next call returns T_EOF
- if (!s->single_line_only)
- {
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+
+ --YYCURSOR; // next call returns T_EOF
+ if (!s->single_line_only)
+ {
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_warning,
                 "Unterminated 'C++' style comment");
- }
- BOOST_WAVE_RET(T_CPPCOMMENT);
- }
-
- anyctrl
- {
- // flag the error
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ BOOST_WAVE_RET(T_CPPCOMMENT);
+ }
+
+ anyctrl
+ {
+ // flag the error
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
         (*s->error_proc)(s, lexing_exception::generic_lexing_error,
             "invalid character '\\%03o' in input stream", *--YYCURSOR);
- }
-*/
-
-/* this subscanner is called whenever a pp_number has been started */
-pp_number:
-{
- cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column);
- marker = uchar_wrapper(s->ptr);
- limit = uchar_wrapper(s->lim);
-
- if (s->detect_pp_numbers) {
- /*!re2c
- "."? Digit (Digit | NonDigit | ExponentStart | ".")*
- { BOOST_WAVE_RET(T_PP_NUMBER); }
- */
- }
- else {
- /*!re2c
- ((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
- { BOOST_WAVE_RET(T_FLOATLIT); }
-
- Integer { goto integer_suffix; }
- */
- }
-}
-
-/* this subscanner is called, whenever a Integer was recognized */
-integer_suffix:
-{
- if (s->enable_ms_extensions) {
- /*!re2c
- LongIntegerSuffix | "i64"
- { BOOST_WAVE_RET(T_LONGINTLIT); }
-
- IntegerSuffix?
- { BOOST_WAVE_RET(T_INTLIT); }
- */
- }
- else {
- /*!re2c
- LongIntegerSuffix
- { BOOST_WAVE_RET(T_LONGINTLIT); }
-
- IntegerSuffix?
- { BOOST_WAVE_RET(T_INTLIT); }
- */
- }
-}
+ }
+*/
+
+/* this subscanner is called whenever a pp_number has been started */
+pp_number:
+{
+ cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column);
+ marker = uchar_wrapper(s->ptr);
+ limit = uchar_wrapper(s->lim);
+
+ if (s->detect_pp_numbers) {
+ /*!re2c
+ "."? Digit (Digit | NonDigit | ExponentStart | ".")*
+ { BOOST_WAVE_RET(T_PP_NUMBER); }
+ */
+ }
+ else {
+ /*!re2c
+ ((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
+ { BOOST_WAVE_RET(T_FLOATLIT); }
+
+ Integer { goto integer_suffix; }
+ */
+ }
+}
+
+/* this subscanner is called, whenever a Integer was recognized */
+integer_suffix:
+{
+ if (s->enable_ms_extensions) {
+ /*!re2c
+ LongIntegerSuffix | "i64"
+ { BOOST_WAVE_RET(T_LONGINTLIT); }
+
+ IntegerSuffix?
+ { BOOST_WAVE_RET(T_INTLIT); }
+ */
+ }
+ else {
+ /*!re2c
+ LongIntegerSuffix
+ { BOOST_WAVE_RET(T_LONGINTLIT); }
+
+ IntegerSuffix?
+ { BOOST_WAVE_RET(T_INTLIT); }
+ */
+ }
+}

Modified: trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re
==============================================================================
--- trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re (original)
+++ trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -1,437 +1,437 @@
-/*=============================================================================
- Boost.Wave: A Standard compliant C++ preprocessor library
-
- Copyright (c) 2001 Daniel C. Nuffer
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+
+ Copyright (c) 2001 Daniel C. Nuffer
     Copyright (c) 2001-2008 Hartmut Kaiser.
- 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)
-
- This is a strict lexer conforming to the Standard as close as possible.
- It does not allow the '$' to be part of identifiers. If you need the '$'
- character in identifiers please include the lexer definition provided
- in the cpp.re file.
-
- TODO:
- handle errors better.
-=============================================================================*/
-
-/*!re2c
-re2c:indent:string = " ";
-any = [\t\v\f\r\n\040-\377];
-anyctrl = [\001-\037];
-OctalDigit = [0-7];
-Digit = [0-9];
-HexDigit = [a-fA-F0-9];
-Integer = (("0" [xX] HexDigit+) | ("0" OctalDigit*) | ([1-9] Digit*));
-ExponentStart = [Ee] [+-];
-ExponentPart = [Ee] [+-]? Digit+;
-FractionalConstant = (Digit* "." Digit+) | (Digit+ ".");
-FloatingSuffix = [fF] [lL]? | [lL] [fF]?;
-IntegerSuffix = [uU] [lL]? | [lL] [uU]?;
-LongIntegerSuffix = [uU] ([lL] [lL]) | ([lL] [lL]) [uU]?;
-Backslash = [\\] | "??/";
-EscapeSequence = Backslash ([abfnrtv?'"] | Backslash | "x" HexDigit+ | OctalDigit OctalDigit? OctalDigit?);
-HexQuad = HexDigit HexDigit HexDigit HexDigit;
-UniversalChar = Backslash ("u" HexQuad | "U" HexQuad HexQuad);
-Newline = "\r\n" | "\n" | "\r";
-PPSpace = ([ \t\f\v]|("/*"(any\[*]|Newline|("*"+(any\[*/]|Newline)))*"*"+"/"))*;
-Pound = "#" | "??=" | "%:";
-NonDigit = [a-zA-Z_] | UniversalChar;
-*/
-
-/*!re2c
- "/*" { goto ccomment; }
- "//" { goto cppcomment; }
- "."? Digit { goto pp_number; }
-
- "asm" { BOOST_WAVE_RET(T_ASM); }
- "auto" { BOOST_WAVE_RET(T_AUTO); }
- "bool" { BOOST_WAVE_RET(T_BOOL); }
- "break" { BOOST_WAVE_RET(T_BREAK); }
- "case" { BOOST_WAVE_RET(T_CASE); }
- "catch" { BOOST_WAVE_RET(T_CATCH); }
- "char" { BOOST_WAVE_RET(T_CHAR); }
- "class" { BOOST_WAVE_RET(T_CLASS); }
- "const" { BOOST_WAVE_RET(T_CONST); }
- "const_cast" { BOOST_WAVE_RET(T_CONSTCAST); }
- "continue" { BOOST_WAVE_RET(T_CONTINUE); }
- "default" { BOOST_WAVE_RET(T_DEFAULT); }
- "delete" { BOOST_WAVE_RET(T_DELETE); }
- "do" { BOOST_WAVE_RET(T_DO); }
- "double" { BOOST_WAVE_RET(T_DOUBLE); }
- "dynamic_cast" { BOOST_WAVE_RET(T_DYNAMICCAST); }
- "else" { BOOST_WAVE_RET(T_ELSE); }
- "enum" { BOOST_WAVE_RET(T_ENUM); }
- "explicit" { BOOST_WAVE_RET(T_EXPLICIT); }
- "export" { BOOST_WAVE_RET(T_EXPORT); }
- "extern" { BOOST_WAVE_RET(T_EXTERN); }
- "false" { BOOST_WAVE_RET(T_FALSE); }
- "float" { BOOST_WAVE_RET(T_FLOAT); }
- "for" { BOOST_WAVE_RET(T_FOR); }
- "friend" { BOOST_WAVE_RET(T_FRIEND); }
- "goto" { BOOST_WAVE_RET(T_GOTO); }
- "if" { BOOST_WAVE_RET(T_IF); }
- "import" { BOOST_WAVE_RET(s->enable_import_keyword ? T_IMPORT : T_IDENTIFIER); }
- "inline" { BOOST_WAVE_RET(T_INLINE); }
- "int" { BOOST_WAVE_RET(T_INT); }
- "long" { BOOST_WAVE_RET(T_LONG); }
- "mutable" { BOOST_WAVE_RET(T_MUTABLE); }
- "namespace" { BOOST_WAVE_RET(T_NAMESPACE); }
- "new" { BOOST_WAVE_RET(T_NEW); }
- "operator" { BOOST_WAVE_RET(T_OPERATOR); }
- "private" { BOOST_WAVE_RET(T_PRIVATE); }
- "protected" { BOOST_WAVE_RET(T_PROTECTED); }
- "public" { BOOST_WAVE_RET(T_PUBLIC); }
- "register" { BOOST_WAVE_RET(T_REGISTER); }
- "reinterpret_cast" { BOOST_WAVE_RET(T_REINTERPRETCAST); }
- "return" { BOOST_WAVE_RET(T_RETURN); }
- "short" { BOOST_WAVE_RET(T_SHORT); }
- "signed" { BOOST_WAVE_RET(T_SIGNED); }
- "sizeof" { BOOST_WAVE_RET(T_SIZEOF); }
- "static" { BOOST_WAVE_RET(T_STATIC); }
- "static_cast" { BOOST_WAVE_RET(T_STATICCAST); }
- "struct" { BOOST_WAVE_RET(T_STRUCT); }
- "switch" { BOOST_WAVE_RET(T_SWITCH); }
- "template" { BOOST_WAVE_RET(T_TEMPLATE); }
- "this" { BOOST_WAVE_RET(T_THIS); }
- "throw" { BOOST_WAVE_RET(T_THROW); }
- "true" { BOOST_WAVE_RET(T_TRUE); }
- "try" { BOOST_WAVE_RET(T_TRY); }
- "typedef" { BOOST_WAVE_RET(T_TYPEDEF); }
- "typeid" { BOOST_WAVE_RET(T_TYPEID); }
- "typename" { BOOST_WAVE_RET(T_TYPENAME); }
- "union" { BOOST_WAVE_RET(T_UNION); }
- "unsigned" { BOOST_WAVE_RET(T_UNSIGNED); }
- "using" { BOOST_WAVE_RET(T_USING); }
- "virtual" { BOOST_WAVE_RET(T_VIRTUAL); }
- "void" { BOOST_WAVE_RET(T_VOID); }
- "volatile" { BOOST_WAVE_RET(T_VOLATILE); }
- "wchar_t" { BOOST_WAVE_RET(T_WCHART); }
- "while" { BOOST_WAVE_RET(T_WHILE); }
-
- "__int8" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT8 : T_IDENTIFIER); }
- "__int16" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT16 : T_IDENTIFIER); }
- "__int32" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT32 : T_IDENTIFIER); }
- "__int64" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT64 : T_IDENTIFIER); }
- "_"? "_based" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_BASED : T_IDENTIFIER); }
- "_"? "_declspec" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_DECLSPEC : T_IDENTIFIER); }
- "_"? "_cdecl" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_CDECL : T_IDENTIFIER); }
- "_"? "_fastcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FASTCALL : T_IDENTIFIER); }
- "_"? "_stdcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_STDCALL : T_IDENTIFIER); }
- "__try" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_TRY : T_IDENTIFIER); }
- "__except" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_EXCEPT : T_IDENTIFIER); }
- "__finally" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FINALLY : T_IDENTIFIER); }
- "__leave" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_LEAVE : T_IDENTIFIER); }
- "_"? "_inline" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INLINE : T_IDENTIFIER); }
- "_"? "_asm" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_ASM : T_IDENTIFIER); }
-
- "{" { BOOST_WAVE_RET(T_LEFTBRACE); }
- "??<" { BOOST_WAVE_RET(T_LEFTBRACE_TRIGRAPH); }
- "<%" { BOOST_WAVE_RET(T_LEFTBRACE_ALT); }
- "}" { BOOST_WAVE_RET(T_RIGHTBRACE); }
- "??>" { BOOST_WAVE_RET(T_RIGHTBRACE_TRIGRAPH); }
- "%>" { BOOST_WAVE_RET(T_RIGHTBRACE_ALT); }
- "[" { BOOST_WAVE_RET(T_LEFTBRACKET); }
- "??(" { BOOST_WAVE_RET(T_LEFTBRACKET_TRIGRAPH); }
- "<:" { BOOST_WAVE_RET(T_LEFTBRACKET_ALT); }
- "]" { BOOST_WAVE_RET(T_RIGHTBRACKET); }
- "??)" { BOOST_WAVE_RET(T_RIGHTBRACKET_TRIGRAPH); }
- ":>" { BOOST_WAVE_RET(T_RIGHTBRACKET_ALT); }
- "#" { BOOST_WAVE_RET(T_POUND); }
- "%:" { BOOST_WAVE_RET(T_POUND_ALT); }
- "??=" { BOOST_WAVE_RET(T_POUND_TRIGRAPH); }
- "##" { BOOST_WAVE_RET(T_POUND_POUND); }
- "#??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
- "??=#" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
- "??=??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
- "%:%:" { BOOST_WAVE_RET(T_POUND_POUND_ALT); }
- "(" { BOOST_WAVE_RET(T_LEFTPAREN); }
- ")" { BOOST_WAVE_RET(T_RIGHTPAREN); }
- ";" { BOOST_WAVE_RET(T_SEMICOLON); }
- ":" { BOOST_WAVE_RET(T_COLON); }
- "..." { BOOST_WAVE_RET(T_ELLIPSIS); }
- "?" { BOOST_WAVE_RET(T_QUESTION_MARK); }
- "::"
- {
- if (s->act_in_c99_mode) {
- --YYCURSOR;
- BOOST_WAVE_RET(T_COLON);
- }
- else {
- BOOST_WAVE_RET(T_COLON_COLON);
- }
- }
- "." { BOOST_WAVE_RET(T_DOT); }
- ".*"
- {
- if (s->act_in_c99_mode) {
- --YYCURSOR;
- BOOST_WAVE_RET(T_DOT);
- }
- else {
- BOOST_WAVE_RET(T_DOTSTAR);
- }
- }
- "+" { BOOST_WAVE_RET(T_PLUS); }
- "-" { BOOST_WAVE_RET(T_MINUS); }
- "*" { BOOST_WAVE_RET(T_STAR); }
- "/" { BOOST_WAVE_RET(T_DIVIDE); }
- "%" { BOOST_WAVE_RET(T_PERCENT); }
- "^" { BOOST_WAVE_RET(T_XOR); }
- "??'" { BOOST_WAVE_RET(T_XOR_TRIGRAPH); }
- "xor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XOR_ALT); }
- "&" { BOOST_WAVE_RET(T_AND); }
- "bitand" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_AND_ALT); }
- "|" { BOOST_WAVE_RET(T_OR); }
- "bitor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OR_ALT); }
- "??!" { BOOST_WAVE_RET(T_OR_TRIGRAPH); }
- "~" { BOOST_WAVE_RET(T_COMPL); }
- "??-" { BOOST_WAVE_RET(T_COMPL_TRIGRAPH); }
- "compl" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_COMPL_ALT); }
- "!" { BOOST_WAVE_RET(T_NOT); }
- "not" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOT_ALT); }
- "=" { BOOST_WAVE_RET(T_ASSIGN); }
- "<" { BOOST_WAVE_RET(T_LESS); }
- ">" { BOOST_WAVE_RET(T_GREATER); }
- "+=" { BOOST_WAVE_RET(T_PLUSASSIGN); }
- "-=" { BOOST_WAVE_RET(T_MINUSASSIGN); }
- "*=" { BOOST_WAVE_RET(T_STARASSIGN); }
- "/=" { BOOST_WAVE_RET(T_DIVIDEASSIGN); }
- "%=" { BOOST_WAVE_RET(T_PERCENTASSIGN); }
- "^=" { BOOST_WAVE_RET(T_XORASSIGN); }
- "xor_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XORASSIGN_ALT); }
- "??'=" { BOOST_WAVE_RET(T_XORASSIGN_TRIGRAPH); }
- "&=" { BOOST_WAVE_RET(T_ANDASSIGN); }
- "and_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDASSIGN_ALT); }
- "|=" { BOOST_WAVE_RET(T_ORASSIGN); }
- "or_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ORASSIGN_ALT); }
- "??!=" { BOOST_WAVE_RET(T_ORASSIGN_TRIGRAPH); }
- "<<" { BOOST_WAVE_RET(T_SHIFTLEFT); }
- ">>" { BOOST_WAVE_RET(T_SHIFTRIGHT); }
- ">>=" { BOOST_WAVE_RET(T_SHIFTRIGHTASSIGN); }
- "<<=" { BOOST_WAVE_RET(T_SHIFTLEFTASSIGN); }
- "==" { BOOST_WAVE_RET(T_EQUAL); }
- "!=" { BOOST_WAVE_RET(T_NOTEQUAL); }
- "not_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOTEQUAL_ALT); }
- "<=" { BOOST_WAVE_RET(T_LESSEQUAL); }
- ">=" { BOOST_WAVE_RET(T_GREATEREQUAL); }
- "&&" { BOOST_WAVE_RET(T_ANDAND); }
- "and" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDAND_ALT); }
- "||" { BOOST_WAVE_RET(T_OROR); }
- "??!|" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
- "|??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
- "or" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); }
- "??!??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
- "++" { BOOST_WAVE_RET(T_PLUSPLUS); }
- "--" { BOOST_WAVE_RET(T_MINUSMINUS); }
- "," { BOOST_WAVE_RET(T_COMMA); }
- "->*"
- {
- if (s->act_in_c99_mode) {
- --YYCURSOR;
- BOOST_WAVE_RET(T_ARROW);
- }
- else {
- BOOST_WAVE_RET(T_ARROWSTAR);
- }
- }
- "->" { BOOST_WAVE_RET(T_ARROW); }
- "??/" { BOOST_WAVE_RET(T_ANY_TRIGRAPH); }
-
-
- ([a-zA-Z_] | UniversalChar) ([a-zA-Z_0-9] | UniversalChar)*
- { BOOST_WAVE_RET(T_IDENTIFIER); }
-
- "L"? (['] (EscapeSequence|any\[\n\r\\']|UniversalChar)+ ['])
- { BOOST_WAVE_RET(T_CHARLIT); }
-
- "L"? (["] (EscapeSequence|any\[\n\r\\"]|UniversalChar)* ["])
- { BOOST_WAVE_RET(T_STRINGLIT); }
-
-
- Pound PPSpace ( "include" | "include_next") PPSpace "<" (any\[\n\r>])+ ">"
- { BOOST_WAVE_RET(T_PP_HHEADER); }
-
- Pound PPSpace ( "include" | "include_next") PPSpace "\"" (any\[\n\r"])+ "\""
- { BOOST_WAVE_RET(T_PP_QHEADER); }
-
- Pound PPSpace ( "include" | "include_next") PPSpace
- { BOOST_WAVE_RET(T_PP_INCLUDE); }
-
- Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
- Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
- Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
- Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
- Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
- Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
- Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
- Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
- Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
- Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
- Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
-
- Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
-
- Pound PPSpace "region" { BOOST_WAVE_RET(T_MSEXT_PP_REGION); }
- Pound PPSpace "endregion" { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); }
-
- [ \t\v\f]+
- { BOOST_WAVE_RET(T_SPACE); }
-
- Newline
- {
- s->line++;
- cursor.column = 1;
- BOOST_WAVE_RET(T_NEWLINE);
- }
-
- "\000"
- {
- if (s->eof && cursor != s->eof)
- {
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ 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)
+
+ This is a strict lexer conforming to the Standard as close as possible.
+ It does not allow the '$' to be part of identifiers. If you need the '$'
+ character in identifiers please include the lexer definition provided
+ in the cpp.re file.
+
+ TODO:
+ handle errors better.
+=============================================================================*/
+
+/*!re2c
+re2c:indent:string = " ";
+any = [\t\v\f\r\n\040-\377];
+anyctrl = [\001-\037];
+OctalDigit = [0-7];
+Digit = [0-9];
+HexDigit = [a-fA-F0-9];
+Integer = (("0" [xX] HexDigit+) | ("0" OctalDigit*) | ([1-9] Digit*));
+ExponentStart = [Ee] [+-];
+ExponentPart = [Ee] [+-]? Digit+;
+FractionalConstant = (Digit* "." Digit+) | (Digit+ ".");
+FloatingSuffix = [fF] [lL]? | [lL] [fF]?;
+IntegerSuffix = [uU] [lL]? | [lL] [uU]?;
+LongIntegerSuffix = [uU] ([lL] [lL]) | ([lL] [lL]) [uU]?;
+Backslash = [\\] | "??/";
+EscapeSequence = Backslash ([abfnrtv?'"] | Backslash | "x" HexDigit+ | OctalDigit OctalDigit? OctalDigit?);
+HexQuad = HexDigit HexDigit HexDigit HexDigit;
+UniversalChar = Backslash ("u" HexQuad | "U" HexQuad HexQuad);
+Newline = "\r\n" | "\n" | "\r";
+PPSpace = ([ \t\f\v]|("/*"(any\[*]|Newline|("*"+(any\[*/]|Newline)))*"*"+"/"))*;
+Pound = "#" | "??=" | "%:";
+NonDigit = [a-zA-Z_] | UniversalChar;
+*/
+
+/*!re2c
+ "/*" { goto ccomment; }
+ "//" { goto cppcomment; }
+ "."? Digit { goto pp_number; }
+
+ "asm" { BOOST_WAVE_RET(T_ASM); }
+ "auto" { BOOST_WAVE_RET(T_AUTO); }
+ "bool" { BOOST_WAVE_RET(T_BOOL); }
+ "break" { BOOST_WAVE_RET(T_BREAK); }
+ "case" { BOOST_WAVE_RET(T_CASE); }
+ "catch" { BOOST_WAVE_RET(T_CATCH); }
+ "char" { BOOST_WAVE_RET(T_CHAR); }
+ "class" { BOOST_WAVE_RET(T_CLASS); }
+ "const" { BOOST_WAVE_RET(T_CONST); }
+ "const_cast" { BOOST_WAVE_RET(T_CONSTCAST); }
+ "continue" { BOOST_WAVE_RET(T_CONTINUE); }
+ "default" { BOOST_WAVE_RET(T_DEFAULT); }
+ "delete" { BOOST_WAVE_RET(T_DELETE); }
+ "do" { BOOST_WAVE_RET(T_DO); }
+ "double" { BOOST_WAVE_RET(T_DOUBLE); }
+ "dynamic_cast" { BOOST_WAVE_RET(T_DYNAMICCAST); }
+ "else" { BOOST_WAVE_RET(T_ELSE); }
+ "enum" { BOOST_WAVE_RET(T_ENUM); }
+ "explicit" { BOOST_WAVE_RET(T_EXPLICIT); }
+ "export" { BOOST_WAVE_RET(T_EXPORT); }
+ "extern" { BOOST_WAVE_RET(T_EXTERN); }
+ "false" { BOOST_WAVE_RET(T_FALSE); }
+ "float" { BOOST_WAVE_RET(T_FLOAT); }
+ "for" { BOOST_WAVE_RET(T_FOR); }
+ "friend" { BOOST_WAVE_RET(T_FRIEND); }
+ "goto" { BOOST_WAVE_RET(T_GOTO); }
+ "if" { BOOST_WAVE_RET(T_IF); }
+ "import" { BOOST_WAVE_RET(s->enable_import_keyword ? T_IMPORT : T_IDENTIFIER); }
+ "inline" { BOOST_WAVE_RET(T_INLINE); }
+ "int" { BOOST_WAVE_RET(T_INT); }
+ "long" { BOOST_WAVE_RET(T_LONG); }
+ "mutable" { BOOST_WAVE_RET(T_MUTABLE); }
+ "namespace" { BOOST_WAVE_RET(T_NAMESPACE); }
+ "new" { BOOST_WAVE_RET(T_NEW); }
+ "operator" { BOOST_WAVE_RET(T_OPERATOR); }
+ "private" { BOOST_WAVE_RET(T_PRIVATE); }
+ "protected" { BOOST_WAVE_RET(T_PROTECTED); }
+ "public" { BOOST_WAVE_RET(T_PUBLIC); }
+ "register" { BOOST_WAVE_RET(T_REGISTER); }
+ "reinterpret_cast" { BOOST_WAVE_RET(T_REINTERPRETCAST); }
+ "return" { BOOST_WAVE_RET(T_RETURN); }
+ "short" { BOOST_WAVE_RET(T_SHORT); }
+ "signed" { BOOST_WAVE_RET(T_SIGNED); }
+ "sizeof" { BOOST_WAVE_RET(T_SIZEOF); }
+ "static" { BOOST_WAVE_RET(T_STATIC); }
+ "static_cast" { BOOST_WAVE_RET(T_STATICCAST); }
+ "struct" { BOOST_WAVE_RET(T_STRUCT); }
+ "switch" { BOOST_WAVE_RET(T_SWITCH); }
+ "template" { BOOST_WAVE_RET(T_TEMPLATE); }
+ "this" { BOOST_WAVE_RET(T_THIS); }
+ "throw" { BOOST_WAVE_RET(T_THROW); }
+ "true" { BOOST_WAVE_RET(T_TRUE); }
+ "try" { BOOST_WAVE_RET(T_TRY); }
+ "typedef" { BOOST_WAVE_RET(T_TYPEDEF); }
+ "typeid" { BOOST_WAVE_RET(T_TYPEID); }
+ "typename" { BOOST_WAVE_RET(T_TYPENAME); }
+ "union" { BOOST_WAVE_RET(T_UNION); }
+ "unsigned" { BOOST_WAVE_RET(T_UNSIGNED); }
+ "using" { BOOST_WAVE_RET(T_USING); }
+ "virtual" { BOOST_WAVE_RET(T_VIRTUAL); }
+ "void" { BOOST_WAVE_RET(T_VOID); }
+ "volatile" { BOOST_WAVE_RET(T_VOLATILE); }
+ "wchar_t" { BOOST_WAVE_RET(T_WCHART); }
+ "while" { BOOST_WAVE_RET(T_WHILE); }
+
+ "__int8" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT8 : T_IDENTIFIER); }
+ "__int16" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT16 : T_IDENTIFIER); }
+ "__int32" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT32 : T_IDENTIFIER); }
+ "__int64" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT64 : T_IDENTIFIER); }
+ "_"? "_based" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_BASED : T_IDENTIFIER); }
+ "_"? "_declspec" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_DECLSPEC : T_IDENTIFIER); }
+ "_"? "_cdecl" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_CDECL : T_IDENTIFIER); }
+ "_"? "_fastcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FASTCALL : T_IDENTIFIER); }
+ "_"? "_stdcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_STDCALL : T_IDENTIFIER); }
+ "__try" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_TRY : T_IDENTIFIER); }
+ "__except" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_EXCEPT : T_IDENTIFIER); }
+ "__finally" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FINALLY : T_IDENTIFIER); }
+ "__leave" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_LEAVE : T_IDENTIFIER); }
+ "_"? "_inline" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INLINE : T_IDENTIFIER); }
+ "_"? "_asm" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_ASM : T_IDENTIFIER); }
+
+ "{" { BOOST_WAVE_RET(T_LEFTBRACE); }
+ "??<" { BOOST_WAVE_RET(T_LEFTBRACE_TRIGRAPH); }
+ "<%" { BOOST_WAVE_RET(T_LEFTBRACE_ALT); }
+ "}" { BOOST_WAVE_RET(T_RIGHTBRACE); }
+ "??>" { BOOST_WAVE_RET(T_RIGHTBRACE_TRIGRAPH); }
+ "%>" { BOOST_WAVE_RET(T_RIGHTBRACE_ALT); }
+ "[" { BOOST_WAVE_RET(T_LEFTBRACKET); }
+ "??(" { BOOST_WAVE_RET(T_LEFTBRACKET_TRIGRAPH); }
+ "<:" { BOOST_WAVE_RET(T_LEFTBRACKET_ALT); }
+ "]" { BOOST_WAVE_RET(T_RIGHTBRACKET); }
+ "??)" { BOOST_WAVE_RET(T_RIGHTBRACKET_TRIGRAPH); }
+ ":>" { BOOST_WAVE_RET(T_RIGHTBRACKET_ALT); }
+ "#" { BOOST_WAVE_RET(T_POUND); }
+ "%:" { BOOST_WAVE_RET(T_POUND_ALT); }
+ "??=" { BOOST_WAVE_RET(T_POUND_TRIGRAPH); }
+ "##" { BOOST_WAVE_RET(T_POUND_POUND); }
+ "#??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
+ "??=#" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
+ "??=??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
+ "%:%:" { BOOST_WAVE_RET(T_POUND_POUND_ALT); }
+ "(" { BOOST_WAVE_RET(T_LEFTPAREN); }
+ ")" { BOOST_WAVE_RET(T_RIGHTPAREN); }
+ ";" { BOOST_WAVE_RET(T_SEMICOLON); }
+ ":" { BOOST_WAVE_RET(T_COLON); }
+ "..." { BOOST_WAVE_RET(T_ELLIPSIS); }
+ "?" { BOOST_WAVE_RET(T_QUESTION_MARK); }
+ "::"
+ {
+ if (s->act_in_c99_mode) {
+ --YYCURSOR;
+ BOOST_WAVE_RET(T_COLON);
+ }
+ else {
+ BOOST_WAVE_RET(T_COLON_COLON);
+ }
+ }
+ "." { BOOST_WAVE_RET(T_DOT); }
+ ".*"
+ {
+ if (s->act_in_c99_mode) {
+ --YYCURSOR;
+ BOOST_WAVE_RET(T_DOT);
+ }
+ else {
+ BOOST_WAVE_RET(T_DOTSTAR);
+ }
+ }
+ "+" { BOOST_WAVE_RET(T_PLUS); }
+ "-" { BOOST_WAVE_RET(T_MINUS); }
+ "*" { BOOST_WAVE_RET(T_STAR); }
+ "/" { BOOST_WAVE_RET(T_DIVIDE); }
+ "%" { BOOST_WAVE_RET(T_PERCENT); }
+ "^" { BOOST_WAVE_RET(T_XOR); }
+ "??'" { BOOST_WAVE_RET(T_XOR_TRIGRAPH); }
+ "xor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XOR_ALT); }
+ "&" { BOOST_WAVE_RET(T_AND); }
+ "bitand" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_AND_ALT); }
+ "|" { BOOST_WAVE_RET(T_OR); }
+ "bitor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OR_ALT); }
+ "??!" { BOOST_WAVE_RET(T_OR_TRIGRAPH); }
+ "~" { BOOST_WAVE_RET(T_COMPL); }
+ "??-" { BOOST_WAVE_RET(T_COMPL_TRIGRAPH); }
+ "compl" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_COMPL_ALT); }
+ "!" { BOOST_WAVE_RET(T_NOT); }
+ "not" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOT_ALT); }
+ "=" { BOOST_WAVE_RET(T_ASSIGN); }
+ "<" { BOOST_WAVE_RET(T_LESS); }
+ ">" { BOOST_WAVE_RET(T_GREATER); }
+ "+=" { BOOST_WAVE_RET(T_PLUSASSIGN); }
+ "-=" { BOOST_WAVE_RET(T_MINUSASSIGN); }
+ "*=" { BOOST_WAVE_RET(T_STARASSIGN); }
+ "/=" { BOOST_WAVE_RET(T_DIVIDEASSIGN); }
+ "%=" { BOOST_WAVE_RET(T_PERCENTASSIGN); }
+ "^=" { BOOST_WAVE_RET(T_XORASSIGN); }
+ "xor_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XORASSIGN_ALT); }
+ "??'=" { BOOST_WAVE_RET(T_XORASSIGN_TRIGRAPH); }
+ "&=" { BOOST_WAVE_RET(T_ANDASSIGN); }
+ "and_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDASSIGN_ALT); }
+ "|=" { BOOST_WAVE_RET(T_ORASSIGN); }
+ "or_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ORASSIGN_ALT); }
+ "??!=" { BOOST_WAVE_RET(T_ORASSIGN_TRIGRAPH); }
+ "<<" { BOOST_WAVE_RET(T_SHIFTLEFT); }
+ ">>" { BOOST_WAVE_RET(T_SHIFTRIGHT); }
+ ">>=" { BOOST_WAVE_RET(T_SHIFTRIGHTASSIGN); }
+ "<<=" { BOOST_WAVE_RET(T_SHIFTLEFTASSIGN); }
+ "==" { BOOST_WAVE_RET(T_EQUAL); }
+ "!=" { BOOST_WAVE_RET(T_NOTEQUAL); }
+ "not_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOTEQUAL_ALT); }
+ "<=" { BOOST_WAVE_RET(T_LESSEQUAL); }
+ ">=" { BOOST_WAVE_RET(T_GREATEREQUAL); }
+ "&&" { BOOST_WAVE_RET(T_ANDAND); }
+ "and" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDAND_ALT); }
+ "||" { BOOST_WAVE_RET(T_OROR); }
+ "??!|" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
+ "|??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
+ "or" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); }
+ "??!??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
+ "++" { BOOST_WAVE_RET(T_PLUSPLUS); }
+ "--" { BOOST_WAVE_RET(T_MINUSMINUS); }
+ "," { BOOST_WAVE_RET(T_COMMA); }
+ "->*"
+ {
+ if (s->act_in_c99_mode) {
+ --YYCURSOR;
+ BOOST_WAVE_RET(T_ARROW);
+ }
+ else {
+ BOOST_WAVE_RET(T_ARROWSTAR);
+ }
+ }
+ "->" { BOOST_WAVE_RET(T_ARROW); }
+ "??/" { BOOST_WAVE_RET(T_ANY_TRIGRAPH); }
+
+
+ ([a-zA-Z_] | UniversalChar) ([a-zA-Z_0-9] | UniversalChar)*
+ { BOOST_WAVE_RET(T_IDENTIFIER); }
+
+ "L"? (['] (EscapeSequence|any\[\n\r\\']|UniversalChar)+ ['])
+ { BOOST_WAVE_RET(T_CHARLIT); }
+
+ "L"? (["] (EscapeSequence|any\[\n\r\\"]|UniversalChar)* ["])
+ { BOOST_WAVE_RET(T_STRINGLIT); }
+
+
+ Pound PPSpace ( "include" | "include_next") PPSpace "<" (any\[\n\r>])+ ">"
+ { BOOST_WAVE_RET(T_PP_HHEADER); }
+
+ Pound PPSpace ( "include" | "include_next") PPSpace "\"" (any\[\n\r"])+ "\""
+ { BOOST_WAVE_RET(T_PP_QHEADER); }
+
+ Pound PPSpace ( "include" | "include_next") PPSpace
+ { BOOST_WAVE_RET(T_PP_INCLUDE); }
+
+ Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
+ Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
+ Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
+ Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
+ Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
+ Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
+ Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
+ Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
+ Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
+ Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
+ Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
+
+ Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
+
+ Pound PPSpace "region" { BOOST_WAVE_RET(T_MSEXT_PP_REGION); }
+ Pound PPSpace "endregion" { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); }
+
+ [ \t\v\f]+
+ { BOOST_WAVE_RET(T_SPACE); }
+
+ Newline
+ {
+ s->line++;
+ cursor.column = 1;
+ BOOST_WAVE_RET(T_NEWLINE);
+ }
+
+ "\000"
+ {
+ if (s->eof && cursor != s->eof)
+ {
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_error,
                 "invalid character '\\000' in input stream");
- }
- BOOST_WAVE_RET(T_EOF);
- }
-
- any { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
-
- anyctrl
- {
- // flag the error
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ BOOST_WAVE_RET(T_EOF);
+ }
+
+ any { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
+
+ anyctrl
+ {
+ // flag the error
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
         (*s->error_proc)(s, lexing_exception::generic_lexing_error,
             "invalid character '\\%03o' in input stream", *--YYCURSOR);
- }
-*/
-
-ccomment:
-/*!re2c
- "*/" { BOOST_WAVE_RET(T_CCOMMENT); }
-
- Newline
- {
- /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
- /*s->tok = cursor; */
- s->line += count_backslash_newlines(s, cursor) +1;
- cursor.column = 1;
- goto ccomment;
- }
-
- any { goto ccomment; }
-
- "\000"
- {
- if(cursor == s->eof)
- {
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+*/
+
+ccomment:
+/*!re2c
+ "*/" { BOOST_WAVE_RET(T_CCOMMENT); }
+
+ Newline
+ {
+ /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
+ /*s->tok = cursor; */
+ s->line += count_backslash_newlines(s, cursor) +1;
+ cursor.column = 1;
+ goto ccomment;
+ }
+
+ any { goto ccomment; }
+
+ "\000"
+ {
+ if(cursor == s->eof)
+ {
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_warning,
                 "unterminated 'C' style comment");
- }
- else
- {
- --YYCURSOR; // next call returns T_EOF
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ else
+ {
+ --YYCURSOR; // next call returns T_EOF
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_error,
                 "invalid character: '\\000' in input stream");
- }
- }
-
- anyctrl
- {
- // flag the error
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ }
+
+ anyctrl
+ {
+ // flag the error
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
         (*s->error_proc)(s, lexing_exception::generic_lexing_error,
             "invalid character '\\%03o' in input stream", *--YYCURSOR);
- }
-*/
-
-cppcomment:
-/*!re2c
- Newline
- {
- /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
- /*s->tok = cursor; */
- s->line++;
- cursor.column = 1;
- BOOST_WAVE_RET(T_CPPCOMMENT);
- }
-
- any { goto cppcomment; }
-
- "\000"
- {
- if (s->eof && cursor != s->eof)
- {
- --YYCURSOR; // next call returns T_EOF
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+*/
+
+cppcomment:
+/*!re2c
+ Newline
+ {
+ /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
+ /*s->tok = cursor; */
+ s->line++;
+ cursor.column = 1;
+ BOOST_WAVE_RET(T_CPPCOMMENT);
+ }
+
+ any { goto cppcomment; }
+
+ "\000"
+ {
+ if (s->eof && cursor != s->eof)
+ {
+ --YYCURSOR; // next call returns T_EOF
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_error,
                 "invalid character '\\000' in input stream");
- }
-
- --YYCURSOR; // next call returns T_EOF
- if (!s->single_line_only)
- {
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+
+ --YYCURSOR; // next call returns T_EOF
+ if (!s->single_line_only)
+ {
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
             (*s->error_proc)(s, lexing_exception::generic_lexing_warning,
                 "Unterminated 'C++' style comment");
- }
- BOOST_WAVE_RET(T_CPPCOMMENT);
- }
-
- anyctrl
- {
- // flag the error
- BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
+ }
+ BOOST_WAVE_RET(T_CPPCOMMENT);
+ }
+
+ anyctrl
+ {
+ // flag the error
+ BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
         (*s->error_proc)(s, lexing_exception::generic_lexing_error,
             "invalid character '\\%03o' in input stream", *--YYCURSOR);
- }
-*/
-
-/* this subscanner is called whenever a pp_number has been started */
-pp_number:
-{
- cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column);
- marker = uchar_wrapper(s->ptr);
- limit = uchar_wrapper(s->lim);
-
- if (s->detect_pp_numbers) {
- /*!re2c
- "."? Digit (Digit | NonDigit | ExponentStart | ".")*
- { BOOST_WAVE_RET(T_PP_NUMBER); }
- */
- }
- else {
- /*!re2c
- ((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
- { BOOST_WAVE_RET(T_FLOATLIT); }
-
- Integer { goto integer_suffix; }
- */
- }
-}
-
-/* this subscanner is called, whenever a Integer was recognized */
-integer_suffix:
-{
- if (s->enable_ms_extensions) {
- /*!re2c
- LongIntegerSuffix | "i64"
- { BOOST_WAVE_RET(T_LONGINTLIT); }
-
- IntegerSuffix?
- { BOOST_WAVE_RET(T_INTLIT); }
- */
- }
- else {
- /*!re2c
- LongIntegerSuffix
- { BOOST_WAVE_RET(T_LONGINTLIT); }
-
- IntegerSuffix?
- { BOOST_WAVE_RET(T_INTLIT); }
- */
- }
-}
+ }
+*/
+
+/* this subscanner is called whenever a pp_number has been started */
+pp_number:
+{
+ cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column);
+ marker = uchar_wrapper(s->ptr);
+ limit = uchar_wrapper(s->lim);
+
+ if (s->detect_pp_numbers) {
+ /*!re2c
+ "."? Digit (Digit | NonDigit | ExponentStart | ".")*
+ { BOOST_WAVE_RET(T_PP_NUMBER); }
+ */
+ }
+ else {
+ /*!re2c
+ ((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
+ { BOOST_WAVE_RET(T_FLOATLIT); }
+
+ Integer { goto integer_suffix; }
+ */
+ }
+}
+
+/* this subscanner is called, whenever a Integer was recognized */
+integer_suffix:
+{
+ if (s->enable_ms_extensions) {
+ /*!re2c
+ LongIntegerSuffix | "i64"
+ { BOOST_WAVE_RET(T_LONGINTLIT); }
+
+ IntegerSuffix?
+ { BOOST_WAVE_RET(T_INTLIT); }
+ */
+ }
+ else {
+ /*!re2c
+ LongIntegerSuffix
+ { BOOST_WAVE_RET(T_LONGINTLIT); }
+
+ IntegerSuffix?
+ { BOOST_WAVE_RET(T_INTLIT); }
+ */
+ }
+}

Added: trunk/libs/wave/test/testwave/collect_hooks_information.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/wave/test/testwave/collect_hooks_information.hpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -0,0 +1,681 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+ http://www.boost.org/
+
+ Copyright (c) 2001-2008 Hartmut Kaiser. 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_WAVE_LIBS_WAVE_TEST_COLLECT_HOOKS_INFORMATION_HPP)
+#define BOOST_WAVE_LIBS_WAVE_TEST_COLLECT_HOOKS_INFORMATION_HPP
+
+#include <boost/lexical_cast.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// workaround for missing ostringstream
+#ifdef BOOST_NO_STRINGSTREAM
+#include <strstream>
+#define BOOST_WAVETEST_OSSTREAM std::ostrstream
+std::string BOOST_WAVETEST_GETSTRING(std::ostrstream& ss)
+{
+ ss << ends;
+ std::string rval = ss.str();
+ ss.freeze(false);
+ return rval;
+}
+#else
+#include <sstream>
+#define BOOST_WAVETEST_GETSTRING(ss) ss.str()
+#define BOOST_WAVETEST_OSSTREAM std::ostringstream
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+template <typename String>
+String handle_filepath(String const &name)
+{
+ using boost::wave::util::impl::unescape_lit;
+
+ String unesc_name (unescape_lit(name));
+ typename String::size_type p = unesc_name.find_last_of("/\\");
+ if (p != unesc_name.npos)
+ unesc_name = unesc_name.substr(p+1);
+ return unesc_name;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+template <typename String>
+inline std::string repr(boost::wave::util::file_position<String> const& pos)
+{
+ return handle_filepath(pos.get_file()) + String("(") +
+ boost::lexical_cast<String>(pos.get_line()) + ")";
+}
+
+///////////////////////////////////////////////////////////////////////////////
+template <typename Token>
+class collect_hooks_information
+ : public boost::wave::context_policies::eat_whitespace<Token>
+{
+ typedef boost::wave::context_policies::eat_whitespace<Token> base_type;
+
+public:
+ collect_hooks_information(std::string& trace)
+ : hooks_trace(trace)
+ {}
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'expanding_function_like_macro' is called, whenever a
+ // function-like macro is to be expanded.
+ //
+ // The parameter 'macrodef' marks the position, where the macro to expand
+ // is defined.
+ //
+ // The parameter 'formal_args' holds the formal arguments used during the
+ // definition of the macro.
+ //
+ // The parameter 'definition' holds the macro definition for the macro to
+ // trace.
+ //
+ // The parameter 'macro_call' marks the position, where this macro invoked.
+ //
+ // The parameter 'arguments' holds the macro arguments used during the
+ // invocation of the macro
+ //
+ // The parameters 'seqstart' and 'seqend' point into the input token
+ // stream allowing to access the whole token sequence comprising the macro
+ // invocation (starting with the opening parenthesis and ending after the
+ // closing one).
+ //
+ // The return value defines, whether the corresponding macro will be
+ // expanded (return false) or will be copied to the output (return true).
+ // Note: the whole argument list is copied unchanged to the output as well
+ // without any further processing.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ template <typename Context, typename Container, typename Iterator>
+ bool
+ expanding_function_like_macro(Context const& ctx,
+ Token const& macro, std::vector<Token> const& formal_args,
+ Container const& definition,
+ Token const& macrocall, std::vector<Container> const& arguments,
+ Iterator const& seqstart, Iterator const& seqend)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ // trace real macro call
+ strm << "00: " << repr(macrocall.get_position()) << ": "
+ << macrocall.get_value() << "(";
+ for (typename std::vector<Token>::size_type i = 0;
+ i < arguments.size(); ++i)
+ {
+ strm << boost::wave::util::impl::as_string(arguments[i]);
+ if (i < arguments.size()-1)
+ strm << ",";
+ }
+ strm << "), ";
+
+ // trace macro definition
+ strm << "[" << repr(macro.get_position()) << ": "
+ << macro.get_value() << "(";
+ for (typename std::vector<Token>::size_type i = 0;
+ i < formal_args.size(); ++i)
+ {
+ strm << formal_args[i].get_value();
+ if (i < formal_args.size()-1)
+ strm << ", ";
+ }
+ strm << ")=" << boost::wave::util::impl::as_string(definition) << "]"
+ << std::endl;
+
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false; // default is to normally expand the macro
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'expanding_object_like_macro' is called, whenever a
+ // object-like macro is to be expanded .
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'macro' marks the position, where the macro to expand
+ // is defined.
+ //
+ // The definition 'definition' holds the macro definition for the macro to
+ // trace.
+ //
+ // The parameter 'macrocall' marks the position, where this macro invoked.
+ //
+ // The return value defines, whether the corresponding macro will be
+ // expanded (return false) or will be copied to the output (return true).
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ bool
+ expanding_object_like_macro(Context const& ctx, Token const& macro,
+ Container const& definition, Token const& macrocall)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "01: " << repr(macro.get_position()) << ": "
+ << macro.get_value() << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false; // default is to normally expand the macro
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'expanded_macro' is called, whenever the expansion of a
+ // macro is finished but before the rescanning process starts.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'result' contains the token sequence generated as the
+ // result of the macro expansion.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ void expanded_macro(Context const& ctx, Container const& result)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "02: " << boost::wave::util::impl::as_string(result) << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'rescanned_macro' is called, whenever the rescanning of a
+ // macro is finished.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'result' contains the token sequence generated as the
+ // result of the rescanning.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ void rescanned_macro(Context const& ctx, Container const& result)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "03: " << boost::wave::util::impl::as_string(result) << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'found_include_directive' is called, whenever a #include
+ // directive was located.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'filename' contains the (expanded) file name found after
+ // the #include directive. This has the format '<file>', '"file"' or
+ // 'file'.
+ // The formats '<file>' or '"file"' are used for #include directives found
+ // in the preprocessed token stream, the format 'file' is used for files
+ // specified through the --force_include command line argument.
+ //
+ // The parameter 'include_next' is set to true if the found directive was
+ // a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT
+ // preprocessing constant was defined to something != 0.
+ //
+ // The return value defines, whether the found file will be included
+ // (return false) or will be skipped (return true).
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ bool
+ found_include_directive(Context const& ctx, std::string const& filename,
+ bool include_next)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "04: " << filename;
+ if (include_next)
+ strm << " (include_next)";
+ strm << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false; // ok to include this file
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'opened_include_file' is called, whenever a file referred
+ // by an #include directive was successfully located and opened.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'filename' contains the file system path of the
+ // opened file (this is relative to the directory of the currently
+ // processed file or a absolute path depending on the paths given as the
+ // include search paths).
+ //
+ // The include_depth parameter contains the current include file depth.
+ //
+ // The is_system_include parameter denotes, whether the given file was
+ // found as a result of a #include <...> directive.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ void
+ opened_include_file(Context const& ctx, std::string const& relname,
+ std::string const& absname, bool is_system_include)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "05: " << relname << " (" << absname << ")" << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'returning_from_include_file' is called, whenever an
+ // included file is about to be closed after it's processing is complete.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ void
+ returning_from_include_file(Context const& ctx)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "06: " << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'interpret_pragma' is called, whenever a #pragma command
+ // directive is found which isn't known to the core Wave library, where
+ // command is the value defined as the BOOST_WAVE_PRAGMA_KEYWORD constant
+ // which defaults to "wave".
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'pending' may be used to push tokens back into the input
+ // stream, which are to be used as the replacement text for the whole
+ // #pragma directive.
+ //
+ // The parameter 'option' contains the name of the interpreted pragma.
+ //
+ // The parameter 'values' holds the values of the parameter provided to
+ // the pragma operator.
+ //
+ // The parameter 'act_token' contains the actual #pragma token, which may
+ // be used for error output.
+ //
+ // If the return value is 'false', the whole #pragma directive is
+ // interpreted as unknown and a corresponding error message is issued. A
+ // return value of 'true' signs a successful interpretation of the given
+ // #pragma.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ bool
+ interpret_pragma(Context const& ctx, Container &pending,
+ Token const& option, Container const& values, Token const& act_token)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "07: " << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'defined_macro' is called, whenever a macro was defined
+ // successfully.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'name' is a reference to the token holding the macro name.
+ //
+ // The parameter 'is_functionlike' is set to true, whenever the newly
+ // defined macro is defined as a function like macro.
+ //
+ // The parameter 'parameters' holds the parameter tokens for the macro
+ // definition. If the macro has no parameters or if it is a object like
+ // macro, then this container is empty.
+ //
+ // The parameter 'definition' contains the token sequence given as the
+ // replacement sequence (definition part) of the newly defined macro.
+ //
+ // The parameter 'is_predefined' is set to true for all macros predefined
+ // during the initialization phase of the library.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ void
+ defined_macro(Context const& ctx, Token const& macro,
+ bool is_functionlike, std::vector<Token> const& pars,
+ Container const& definition, bool is_predefined)
+ {
+ // do not trace the definition of the internal helper macros
+ if (!is_predefined) {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "08: " << repr(macro.get_position()) << ": "
+ << macro.get_value();
+ if (is_functionlike) {
+ // list the parameter names for function style macros
+ strm << "(";
+ for (typename std::vector<Token>::size_type i = 0;
+ i < pars.size(); ++i)
+ {
+ strm << pars[i].get_value();
+ if (i < pars.size()-1)
+ strm << ", ";
+ }
+ strm << ")";
+ }
+ strm << "=" << boost::wave::util::impl::as_string(definition)
+ << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'undefined_macro' is called, whenever a macro definition
+ // was removed successfully.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'name' holds the name of the macro, which definition was
+ // removed.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ void
+ undefined_macro(Context const& ctx, Token const& macro)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "09: " << repr(macro.get_position()) << ": "
+ << macro.get_value() << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'found_directive' is called, whenever a preprocessor
+ // directive was encountered, but before the corresponding action is
+ // executed.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'directive' is a reference to the token holding the
+ // preprocessing directive.
+ //
+ // The return value defines, whether the given expression has to be
+ // to be executed in a normal way (return 'false'), or if it has to be
+ // skipped altogether (return 'true'), which means it gets replaced in the
+ // output by a single newline.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ bool
+ found_directive(Context const& ctx, Token const& directive)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "10: " << repr(directive.get_position()) << ": "
+ << directive.get_value() << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false; // by default we never skip any directives
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'evaluated_conditional_expression' is called, whenever a
+ // conditional preprocessing expression was evaluated (the expression
+ // given to a #if, #elif, #ifdef or #ifndef directive)
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'directive' is a reference to the token holding the
+ // corresponding preprocessing directive.
+ //
+ // The parameter 'expression' holds the non-expanded token sequence
+ // comprising the evaluated expression.
+ //
+ // The parameter expression_value contains the result of the evaluation of
+ // the expression in the current preprocessing context.
+ //
+ // The return value defines, whether the given expression has to be
+ // evaluated again, allowing to decide which of the conditional branches
+ // should be expanded. You need to return 'true' from this hook function
+ // to force the expression to be re-evaluated.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ bool
+ evaluated_conditional_expression(Context const& ctx,
+ Token const& directive, Container const& expression,
+ bool expression_value)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "11: " << repr(directive.get_position()) << ": "
+ << directive.get_value() << " "
+ << boost::wave::util::impl::as_string(expression) << ": "
+ << expression_value << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false; // ok to continue, do not re-evaluate expression
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'skipped_token' is called, whenever a token is about to be
+ // skipped due to a false preprocessor condition (code fragments to be
+ // skipped inside the not evaluated conditional #if/#else/#endif branches).
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'token' refers to the token to be skipped.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ void
+ skipped_token(Context const& ctx, Token const& token)
+ {
+// this generates a lot of noise
+// BOOST_WAVETEST_OSSTREAM strm;
+// strm << "12: " << std::endl;
+// hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'generated_token' will be called by the library whenever a
+ // token is about to be returned from the library.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 't' is the token about to be returned from the library.
+ // This function may alter the token, but in this case it must be
+ // implemented with a corresponding signature:
+ //
+ // Token const&
+ // generated_token(Context const& ctx, Token& t);
+ //
+ // which makes it possible to modify the token in place.
+ //
+ // The default behavior is to return the token passed as the parameter
+ // without modification.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ Token const&
+ generated_token(Context const& ctx, Token const& t)
+ {
+// this generates a lot of noise
+// BOOST_WAVETEST_OSSTREAM strm;
+// strm << "13: " << std::endl;
+// hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return t;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'may_skip_whitespace' will be called by the
+ // library, whenever it must be tested whether a specific token refers to
+ // whitespace and this whitespace has to be skipped.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The 'token' parameter holds a reference to the current token. The policy
+ // is free to change this token if needed.
+ //
+ // The 'skipped_newline' parameter holds a reference to a boolean value
+ // which should be set to true by the policy function whenever a newline
+ // is going to be skipped.
+ //
+ // If the return value is true, the given token is skipped and the
+ // preprocessing continues to the next token. If the return value is
+ // false, the given token is returned to the calling application.
+ //
+ // ATTENTION!
+ // Caution has to be used, because by returning true the policy function
+ // is able to force skipping even significant tokens, not only whitespace.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context>
+ bool
+ may_skip_whitespace(Context const& ctx, Token& token, bool& skipped_newline)
+ {
+// this generates a lot of noise
+// BOOST_WAVETEST_OSSTREAM strm;
+// strm << "14: " << std::endl;
+// hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return this->base_type::may_skip_whitespace(ctx, token, skipped_newline);
+ }
+
+#if BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE != 0
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'found_warning_directive' will be called by the library
+ // whenever a #warning directive is found.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'message' references the argument token sequence of the
+ // encountered #warning directive.
+ //
+ // If the return value is false, the library throws a preprocessor
+ // exception of the type 'warning_directive', if the return value is true
+ // the execution continues as if no #warning directive has been found.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ bool
+ found_warning_directive(Context const& ctx, Container const& message)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "15: " << boost::wave::util::impl::as_string(message)
+ << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false;
+ }
+#endif
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'found_error_directive' will be called by the library
+ // whenever a #error directive is found.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'message' references the argument token sequence of the
+ // encountered #error directive.
+ //
+ // If the return value is false, the library throws a preprocessor
+ // exception of the type 'error_directive', if the return value is true
+ // the execution continues as if no #error directive has been found.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ bool
+ found_error_directive(Context const& ctx, Container const& message)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "16: " << boost::wave::util::impl::as_string(message)
+ << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'found_line_directive' will be called by the library
+ // whenever a #line directive is found.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'arguments' references the argument token sequence of the
+ // encountered #line directive.
+ //
+ // The parameter 'line' contains the recognized line number from the #line
+ // directive.
+ //
+ // The parameter 'filename' references the recognized file name from the
+ // #line directive (if there was one given).
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Container>
+ void
+ found_line_directive(Context const& ctx, Container const& arguments,
+ unsigned int line, std::string const& filename)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "17: " << boost::wave::util::impl::as_string(arguments)
+ << " (" << line << ", \"" << filename << "\")" << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'throw_exception' will be called by the library whenever a
+ // preprocessing exception occurs.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'e' is the exception object containing detailed error
+ // information.
+ //
+ // The default behavior is to call the function boost::throw_exception.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Context, typename Exception>
+ void
+ throw_exception(Context const& ctx, Exception const& e)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "18: " << e.what() << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return this->base_type::throw_exception(ctx, e);
+ }
+
+private:
+ std::string& hooks_trace;
+};
+
+#endif
+
+
+

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_001.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_001.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_001.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,19 @@
 
 //R #line 16 "t_1_001.cpp"
 C( A(2, 3) ) //R [2][3]
+
+//H 10: t_1_001.cpp(11): #define
+//H 08: t_1_001.cpp(11): A(x, y)=x, y
+//H 10: t_1_001.cpp(12): #define
+//H 08: t_1_001.cpp(12): B(x, y)=[x][y]
+//H 10: t_1_001.cpp(13): #define
+//H 08: t_1_001.cpp(13): C(x)=B(x)
+//H 00: t_1_001.cpp(16): C( A(2, 3) ), [t_1_001.cpp(13): C(x)=B(x)]
+//H 00: t_1_001.cpp(16): A(2, 3), [t_1_001.cpp(11): A(x, y)=x, y]
+//H 02: 2, 3
+//H 03: 2, 3
+//H 02: B(2, 3)
+//H 00: t_1_001.cpp(13): B(2, 3), [t_1_001.cpp(12): B(x, y)=[x][y]]
+//H 02: [2][3]
+//H 03: [2][3]
+//H 03: [2][3]

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_002.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_002.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_002.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,12 @@
 
 //R #line 16 "t_1_002.cpp"
 ABC() //R 1
+
+//H 10: t_1_002.cpp(11): #if
+//H 11: t_1_002.cpp(11): #if defined(TEST): 1
+//H 10: t_1_002.cpp(12): #define
+//H 08: t_1_002.cpp(12): ABC()=1
+//H 10: t_1_002.cpp(13): #endif
+//H 00: t_1_002.cpp(16): ABC(), [t_1_002.cpp(12): ABC()=1]
+//H 02: 1
+//H 03: 1

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_003.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_003.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_003.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -25,7 +25,36 @@
 //R #line 27 "t_1_003.cpp"
 //R CONCAT(1, 2)
 CONCAT(CONCAT_, INDIRECT())(1, 2)
-// E t_1_003.cpp(29): error: pasting the following two tokens does not give a valid preprocessing token: "1" and "CONCAT"
+
 //R #line 31 "t_1_003.cpp"
 //R 1 CONCAT(2, 3)
 CONCAT(1, CONCAT(2, 3))
+
+//H 10: t_1_003.cpp(13): #define
+//H 08: t_1_003.cpp(13): CONCAT(a, b)=a ## b
+//H 10: t_1_003.cpp(14): #define
+//H 08: t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT
+//H 00: t_1_003.cpp(18): CONCAT(CON, CAT), [t_1_003.cpp(13): CONCAT(a, b)=a ## b]
+//H 02: CONCAT
+//H 03: CONCAT
+//H 00: t_1_003.cpp(21): CONCAT(CON, CAT(1, 2)), [t_1_003.cpp(13): CONCAT(a, b)=a ## b]
+//H 02: CONCAT(1, 2)
+//H 03: CONCAT(1, 2)
+//H 00: t_1_003.cpp(24): CONCAT(CONCAT_, INDIRECT), [t_1_003.cpp(13): CONCAT(a, b)=a ## b]
+//H 02: CONCAT_INDIRECT
+//H 03: CONCAT_INDIRECT
+//H 00: t_1_003.cpp(24): CONCAT_INDIRECT(), [t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT]
+//H 02: CONCAT
+//H 03: CONCAT
+//H 00: t_1_003.cpp(14): CONCAT(1, 2), [t_1_003.cpp(13): CONCAT(a, b)=a ## b]
+//H 02: 12
+//H 03: 12
+//H 00: t_1_003.cpp(27): CONCAT(CONCAT_, INDIRECT()), [t_1_003.cpp(13): CONCAT(a, b)=a ## b]
+//H 02: CONCAT_INDIRECT()
+//H 00: t_1_003.cpp(27): CONCAT_INDIRECT(), [t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT]
+//H 02: CONCAT
+//H 03: CONCAT
+//H 03: CONCAT
+//H 00: t_1_003.cpp(31): CONCAT(1, CONCAT(2, 3)), [t_1_003.cpp(13): CONCAT(a, b)=a ## b]
+//H 02: 1CONCAT(2, 3)
+//H 03: 1CONCAT(2, 3)

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_004.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_004.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_004.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -30,3 +30,59 @@
 //R #line 32 "t_1_004.cpp"
 //R 1 CONCAT(2, 3)
 CONCAT(1, CONCAT(2, 3))
+
+//H 10: t_1_004.cpp(15): #define
+//H 08: t_1_004.cpp(15): CONCAT(a, b)=a ## b
+//H 10: t_1_004.cpp(16): #define
+//H 08: t_1_004.cpp(16): CONCAT_INDIRECT()=CONCAT
+//H 00: t_1_004.cpp(20): CONCAT(CON, CAT), [t_1_004.cpp(15): CONCAT(a, b)=a ## b]
+//H 02: CONCAT
+//H 03: CONCAT
+//H 00: t_1_004.cpp(23): CONCAT(CON, CAT(1, 2)), [t_1_004.cpp(15): CONCAT(a, b)=a ## b]
+//H 02: CONCAT(1, 2)
+//H 03: CONCAT(1, 2)
+//H 00: t_1_004.cpp(26): CONCAT(CONCAT_, INDIRECT), [t_1_004.cpp(15): CONCAT(a, b)=a ## b]
+//H 02: CONCAT_INDIRECT
+//H 03: CONCAT_INDIRECT
+//H 00: t_1_004.cpp(26): CONCAT_INDIRECT(), [t_1_004.cpp(16): CONCAT_INDIRECT()=CONCAT]
+//H 02: CONCAT
+//H 03: CONCAT
+//H 00: t_1_004.cpp(16): CONCAT(1, 2), [t_1_004.cpp(15): CONCAT(a, b)=a ## b]
+//H 02: 12
+//H 03: 12
+//H 00: t_1_004.cpp(29): CONCAT(CONCAT_, INDIRECT()), [t_1_004.cpp(15): CONCAT(a, b)=a ## b]
+//H 02: CONCAT_INDIRECT()
+//H 00: t_1_004.cpp(29): CONCAT_INDIRECT(), [t_1_004.cpp(16): CONCAT_INDIRECT()=CONCAT]
+//H 02: CONCAT
+//H 03: CONCAT
+//H 03: CONCAT
+//H 00: t_1_004.cpp(32): CONCAT(1, CONCAT(2, 3)), [t_1_004.cpp(15): CONCAT(a, b)=a ## b]
+//H 02: 1CONCAT(2, 3)
+//H 03: 1CONCAT(2, 3)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_005.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_005.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_005.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -15,3 +15,13 @@
 //R #line 16 "t_1_005.cpp"
 A()(123) //R 123
 
+//H 10: t_1_005.cpp(12): #define
+//H 08: t_1_005.cpp(12): A()=B
+//H 10: t_1_005.cpp(13): #define
+//H 08: t_1_005.cpp(13): B(x)=x
+//H 00: t_1_005.cpp(16): A(), [t_1_005.cpp(12): A()=B]
+//H 02: B
+//H 03: B
+//H 00: t_1_005.cpp(12): B(123), [t_1_005.cpp(13): B(x)=x]
+//H 02: 123
+//H 03: 123

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_006.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_006.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_006.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -23,3 +23,33 @@
 //R #line 25 "t_1_006.cpp"
 //R 1 CONCAT(2, 3)
 PRIMITIVE_CONCAT(1, CONCAT(2, 3))
+
+//H 10: t_1_006.cpp(13): #define
+//H 08: t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)
+//H 10: t_1_006.cpp(14): #define
+//H 08: t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b
+//H 00: t_1_006.cpp(18): CONCAT(1, PRIMITIVE_CONCAT(2, 3)), [t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)]
+//H 00: t_1_006.cpp(18): PRIMITIVE_CONCAT(2, 3), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 23
+//H 03: 23
+//H 02: PRIMITIVE_CONCAT(1, 23)
+//H 00: t_1_006.cpp(13): PRIMITIVE_CONCAT(1, 23), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 123
+//H 03: 123
+//H 03: 123
+//H 00: t_1_006.cpp(21): CONCAT(1, CONCAT(2, 3)), [t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)]
+//H 00: t_1_006.cpp(21): CONCAT(2, 3), [t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)]
+//H 02: PRIMITIVE_CONCAT(2, 3)
+//H 00: t_1_006.cpp(13): PRIMITIVE_CONCAT(2, 3), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 23
+//H 03: 23
+//H 03: 23
+//H 02: PRIMITIVE_CONCAT(1, 23)
+//H 00: t_1_006.cpp(13): PRIMITIVE_CONCAT(1, 23), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 123
+//H 03: 123
+//H 03: 123
+//H 00: t_1_006.cpp(25): PRIMITIVE_CONCAT(1, CONCAT(2, 3)), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 1CONCAT(2, 3)
+//H 03: 1CONCAT(2, 3)
+

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_007.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_007.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_007.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -24,3 +24,32 @@
 //R #line 26 "t_1_007.cpp"
 //R 1 CONCAT(2, 3)
 PRIMITIVE_CONCAT(1, CONCAT(2, 3))
+
+//H 10: t_1_007.cpp(15): #define
+//H 08: t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)
+//H 10: t_1_007.cpp(16): #define
+//H 08: t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b
+//H 00: t_1_007.cpp(20): CONCAT(1, PRIMITIVE_CONCAT(2, 3)), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)]
+//H 00: t_1_007.cpp(20): PRIMITIVE_CONCAT(2, 3), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 23
+//H 03: 23
+//H 02: PRIMITIVE_CONCAT(1, 23)
+//H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(1, 23), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 123
+//H 03: 123
+//H 03: 123
+//H 00: t_1_007.cpp(23): CONCAT(1, CONCAT(2, 3)), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)]
+//H 00: t_1_007.cpp(23): CONCAT(2, 3), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)]
+//H 02: PRIMITIVE_CONCAT(2, 3)
+//H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(2, 3), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 23
+//H 03: 23
+//H 03: 23
+//H 02: PRIMITIVE_CONCAT(1, 23)
+//H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(1, 23), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 123
+//H 03: 123
+//H 03: 123
+//H 00: t_1_007.cpp(26): PRIMITIVE_CONCAT(1, CONCAT(2, 3)), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b]
+//H 02: 1CONCAT(2, 3)
+//H 03: 1CONCAT(2, 3)

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_008.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_008.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_008.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -38,3 +38,108 @@
 //R #line 40 "t_1_008.cpp"
 //R XY
 PARTIAL_CAT(3)( PARTIAL X, Y PARTIAL )
+
+//H 10: t_1_008.cpp(14): #define
+//H 08: t_1_008.cpp(14): CAT(a, b)=a ## b
+//H 10: t_1_008.cpp(16): #define
+//H 08: t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)
+//H 10: t_1_008.cpp(18): #define
+//H 08: t_1_008.cpp(18): PARTIAL_CAT_0(a, b)=CAT(a, b)
+//H 10: t_1_008.cpp(19): #define
+//H 08: t_1_008.cpp(19): PARTIAL_CAT_1(a, b)=CAT(PARTIAL ## a, b)
+//H 10: t_1_008.cpp(20): #define
+//H 08: t_1_008.cpp(20): PARTIAL_CAT_2(a, b)=CAT(a, b ## PARTIAL)
+//H 10: t_1_008.cpp(21): #define
+//H 08: t_1_008.cpp(21): PARTIAL_CAT_3(a, b)=CAT(PARTIAL ## a, b ## PARTIAL)
+//H 10: t_1_008.cpp(23): #define
+//H 08: t_1_008.cpp(23): PARTIAL=
+//H 10: t_1_008.cpp(24): #define
+//H 08: t_1_008.cpp(24): PARTIALPARTIAL=
+//H 10: t_1_008.cpp(26): #define
+//H 08: t_1_008.cpp(26): X=Token1
+//H 10: t_1_008.cpp(27): #define
+//H 08: t_1_008.cpp(27): Y=Token2
+//H 00: t_1_008.cpp(31): PARTIAL_CAT(0), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)]
+//H 02: CAT(PARTIAL_CAT_, 0)
+//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 0), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: PARTIAL_CAT_0
+//H 03: PARTIAL_CAT_0
+//H 03: PARTIAL_CAT_0
+//H 00: t_1_008.cpp(16): PARTIAL_CAT_0( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(18): PARTIAL_CAT_0(a, b)=CAT(a, b)]
+//H 01: t_1_008.cpp(23): PARTIAL
+//H 02:
+//H 03: _
+//H 01: t_1_008.cpp(26): X
+//H 02: Token1
+//H 03: Token1
+//H 01: t_1_008.cpp(27): Y
+//H 02: Token2
+//H 03: Token2
+//H 01: t_1_008.cpp(23): PARTIAL
+//H 02:
+//H 03: _
+//H 02: CAT(Token1, Token2)
+//H 00: t_1_008.cpp(18): CAT(Token1, Token2), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: Token1Token2
+//H 03: Token1Token2
+//H 03: Token1Token2
+//H 00: t_1_008.cpp(34): PARTIAL_CAT(1), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)]
+//H 02: CAT(PARTIAL_CAT_, 1)
+//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 1), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: PARTIAL_CAT_1
+//H 03: PARTIAL_CAT_1
+//H 03: PARTIAL_CAT_1
+//H 00: t_1_008.cpp(16): PARTIAL_CAT_1( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(19): PARTIAL_CAT_1(a, b)=CAT(PARTIAL ## a, b)]
+//H 01: t_1_008.cpp(27): Y
+//H 02: Token2
+//H 03: Token2
+//H 01: t_1_008.cpp(23): PARTIAL
+//H 02:
+//H 03: _
+//H 02: CAT(PARTIALPARTIAL X, Token2)
+//H 00: t_1_008.cpp(19): CAT(PARTIALPARTIAL X, Token2), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: PARTIALPARTIAL XToken2
+//H 01: t_1_008.cpp(24): PARTIALPARTIAL
+//H 02:
+//H 03: _
+//H 03: XToken2
+//H 03: XToken2
+//H 00: t_1_008.cpp(37): PARTIAL_CAT(2), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)]
+//H 02: CAT(PARTIAL_CAT_, 2)
+//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 2), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: PARTIAL_CAT_2
+//H 03: PARTIAL_CAT_2
+//H 03: PARTIAL_CAT_2
+//H 00: t_1_008.cpp(16): PARTIAL_CAT_2( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(20): PARTIAL_CAT_2(a, b)=CAT(a, b ## PARTIAL)]
+//H 01: t_1_008.cpp(23): PARTIAL
+//H 02:
+//H 03: _
+//H 01: t_1_008.cpp(26): X
+//H 02: Token1
+//H 03: Token1
+//H 02: CAT(Token1, Y PARTIALPARTIAL)
+//H 00: t_1_008.cpp(20): CAT(Token1, Y PARTIALPARTIAL), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: Token1Y PARTIALPARTIAL
+//H 01: t_1_008.cpp(24): PARTIALPARTIAL
+//H 02:
+//H 03: _
+//H 03: Token1Y_
+//H 03: Token1Y_
+//H 00: t_1_008.cpp(40): PARTIAL_CAT(3), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)]
+//H 02: CAT(PARTIAL_CAT_, 3)
+//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 3), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: PARTIAL_CAT_3
+//H 03: PARTIAL_CAT_3
+//H 03: PARTIAL_CAT_3
+//H 00: t_1_008.cpp(16): PARTIAL_CAT_3( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(21): PARTIAL_CAT_3(a, b)=CAT(PARTIAL ## a, b ## PARTIAL)]
+//H 02: CAT(PARTIALPARTIAL X, Y PARTIALPARTIAL)
+//H 00: t_1_008.cpp(21): CAT(PARTIALPARTIAL X, Y PARTIALPARTIAL), [t_1_008.cpp(14): CAT(a, b)=a ## b]
+//H 02: PARTIALPARTIAL XY PARTIALPARTIAL
+//H 01: t_1_008.cpp(24): PARTIALPARTIAL
+//H 02:
+//H 03: _
+//H 01: t_1_008.cpp(24): PARTIALPARTIAL
+//H 02:
+//H 03: _
+//H 03: XY_
+//H 03: XY_

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_009.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_009.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_009.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,13 @@
 TEST1()
 //E t_1_009.cpp(19): error: ill formed preprocessing operator: concat ('##')
 TEST2() // error
+
+//H 10: t_1_009.cpp(12): #define
+//H 08: t_1_009.cpp(12): TEST1()=A ## B
+//H 10: t_1_009.cpp(13): #define
+//H 08: t_1_009.cpp(13): TEST2()=## A
+//H 00: t_1_009.cpp(17): TEST1(), [t_1_009.cpp(12): TEST1()=A ## B]
+//H 02: AB
+//H 03: AB
+//H 00: t_1_009.cpp(19): TEST2(), [t_1_009.cpp(13): TEST2()=## A]
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_010.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_010.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_010.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,13 @@
 TEST1()
 //E t_1_010.cpp(19): error: ill formed preprocessing operator: concat ('##')
 TEST2() // error
+
+//H 10: t_1_010.cpp(12): #define
+//H 08: t_1_010.cpp(12): TEST1()=A ## B
+//H 10: t_1_010.cpp(13): #define
+//H 08: t_1_010.cpp(13): TEST2()=A ##
+//H 00: t_1_010.cpp(17): TEST1(), [t_1_010.cpp(12): TEST1()=A ## B]
+//H 02: AB
+//H 03: AB
+//H 00: t_1_010.cpp(19): TEST2(), [t_1_010.cpp(13): TEST2()=A ##]
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_011.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_011.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_011.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,16 @@
 //R #line 19 "t_1_011.cpp"
 //R XMACRO(*)
 CAT( MACRO(*) )
+
+//H 10: t_1_011.cpp(12): #define
+//H 08: t_1_011.cpp(12): MACRO()=
+//H 10: t_1_011.cpp(13): #define
+//H 08: t_1_011.cpp(13): ID(x)=
+//H 10: t_1_011.cpp(14): #define
+//H 08: t_1_011.cpp(14): CAT(x)=X ## x
+//H 00: t_1_011.cpp(16): ID( MACRO(*) ), [t_1_011.cpp(13): ID(x)=]
+//H 02:
+//H 03: _
+//H 00: t_1_011.cpp(19): CAT( MACRO(*) ), [t_1_011.cpp(14): CAT(x)=X ## x]
+//H 02: XMACRO(*)
+//H 03: XMACRO(*)

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_012.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_012.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_012.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -28,3 +28,30 @@
 //R #line 30 "t_1_012.cpp"
 //R 12
 EXPAND(CAT ARGS)
+
+//H 10: t_1_012.cpp(13): #define
+//H 08: t_1_012.cpp(13): CAT(a, b)=a ## b
+//H 10: t_1_012.cpp(14): #define
+//H 08: t_1_012.cpp(14): ARGS=(1, 2)
+//H 01: t_1_012.cpp(14): ARGS
+//H 02: (1, 2)
+//H 03: (1, 2)
+//H 10: t_1_012.cpp(20): #define
+//H 08: t_1_012.cpp(20): INVOKE(macro)=macro ARGS
+//H 00: t_1_012.cpp(24): INVOKE(CAT), [t_1_012.cpp(20): INVOKE(macro)=macro ARGS]
+//H 02: CAT ARGS
+//H 01: t_1_012.cpp(14): ARGS
+//H 02: (1, 2)
+//H 03: (1, 2)
+//H 03: CAT (1, 2)
+//H 10: t_1_012.cpp(26): #define
+//H 08: t_1_012.cpp(26): EXPAND(x)=x
+//H 00: t_1_012.cpp(30): EXPAND(CAT ARGS), [t_1_012.cpp(26): EXPAND(x)=x]
+//H 01: t_1_012.cpp(14): ARGS
+//H 02: (1, 2)
+//H 03: (1, 2)
+//H 02: CAT (1, 2)
+//H 00: t_1_012.cpp(30): CAT(1, 2), [t_1_012.cpp(13): CAT(a, b)=a ## b]
+//H 02: 12
+//H 03: 12
+//H 03: 12

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_013.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_013.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_013.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -34,3 +34,56 @@
 //R "vers2.hpp"
 //R "hello";
 //R "hello" ", world"
+
+//H 10: t_1_013.cpp(13): #define
+//H 08: t_1_013.cpp(13): str(s)=# s
+//H 10: t_1_013.cpp(14): #define
+//H 08: t_1_013.cpp(14): xstr(s)=str(s)
+//H 10: t_1_013.cpp(15): #define
+//H 08: t_1_013.cpp(15): debug(s, t)=printf("x" # s "= %d, x" # t "= %s", x ## s, x ## t)
+//H 10: t_1_013.cpp(17): #define
+//H 08: t_1_013.cpp(17): INCFILE(n)=vers ## n
+//H 10: t_1_013.cpp(18): #define
+//H 08: t_1_013.cpp(18): glue(a, b)=a ## b
+//H 10: t_1_013.cpp(19): #define
+//H 08: t_1_013.cpp(19): xglue(a, b)=glue(a, b)
+//H 10: t_1_013.cpp(20): #define
+//H 08: t_1_013.cpp(20): HIGHLOW="hello"
+//H 10: t_1_013.cpp(21): #define
+//H 08: t_1_013.cpp(21): LOW=LOW ", world"
+//H 00: t_1_013.cpp(22): debug(1, 2), [t_1_013.cpp(15): debug(s, t)=printf("x" # s "= %d, x" # t "= %s", x ## s, x ## t)]
+//H 02: printf("x" "1" "= %d, x" "2" "= %s", x1, x2)
+//H 03: printf("x" "1" "= %d, x" "2" "= %s", x1, x2)
+//H 00: t_1_013.cpp(23): str(strncmp("abc\0d?", "abc", '\4', "\u1234") == 0), [t_1_013.cpp(13): str(s)=# s]
+//H 02: "strncmp(\"abc\\0d\?\", \"abc\", '\\4', \"\\u1234\") == 0"
+//H 03: "strncmp(\"abc\\0d\?\", \"abc\", '\\4', \"\\u1234\") == 0"
+//H 00: t_1_013.cpp(24): str(: @\n), [t_1_013.cpp(13): str(s)=# s]
+//H 02: ": @\n"
+//H 03: ": @\n"
+//H 00: t_1_013.cpp(25): xstr(INCFILE(2).hpp), [t_1_013.cpp(14): xstr(s)=str(s)]
+//H 00: t_1_013.cpp(25): INCFILE(2), [t_1_013.cpp(17): INCFILE(n)=vers ## n]
+//H 02: vers2
+//H 03: vers2
+//H 02: str(vers2.hpp)
+//H 00: t_1_013.cpp(14): str(vers2.hpp), [t_1_013.cpp(13): str(s)=# s]
+//H 02: "vers2.hpp"
+//H 03: "vers2.hpp"
+//H 03: "vers2.hpp"
+//H 00: t_1_013.cpp(26): glue(HIGH, LOW), [t_1_013.cpp(18): glue(a, b)=a ## b]
+//H 02: HIGHLOW
+//H 01: t_1_013.cpp(20): HIGHLOW
+//H 02: "hello"
+//H 03: "hello"
+//H 03: "hello"
+//H 00: t_1_013.cpp(27): xglue(HIGH, LOW), [t_1_013.cpp(19): xglue(a, b)=glue(a, b)]
+//H 01: t_1_013.cpp(21): LOW
+//H 02: LOW ", world"
+//H 03: LOW ", world"
+//H 02: glue(HIGH, LOW ", world")
+//H 00: t_1_013.cpp(19): glue(HIGH, LOW ", world"), [t_1_013.cpp(18): glue(a, b)=a ## b]
+//H 02: HIGHLOW ", world"
+//H 01: t_1_013.cpp(20): HIGHLOW
+//H 02: "hello"
+//H 03: "hello"
+//H 03: "hello" ", world"
+//H 03: "hello" ", world"

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_014.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_014.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_014.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -30,6 +30,6 @@
 
 //R #line 27 "t_1_014.cpp"
 //R f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
-//R f(2 * (2+ (3,4) -0,1))
+//R f(2 * (2+(3,4)-0,1))
 //E t_1_014.cpp(29): error: improperly terminated macro invocation or replacement-list terminates in partial macro expansion (not supported yet): missing ')'
 // should expand to: f(2 * g( ~ 5)) & f(2 * (0,1))^m(0,1);

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_015.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_015.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_015.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,12 @@
 //R #line 16 "t_1_015.cpp"
 //R (4-f((4-f(1))))
 f(f(1))
+
+//H 10: t_1_015.cpp(12): #define
+//H 08: t_1_015.cpp(12): f(x)=(4-f(x))
+//H 00: t_1_015.cpp(16): f(f(1)), [t_1_015.cpp(12): f(x)=(4-f(x))]
+//H 00: t_1_015.cpp(16): f(1), [t_1_015.cpp(12): f(x)=(4-f(x))]
+//H 02: (4-f(1))
+//H 03: (4-f(1))
+//H 02: (4-f((4-f(1))))
+//H 03: (4-f((4-f(1))))

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_016.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_016.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_016.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -16,3 +16,14 @@
 //R #line 18 "t_1_016.cpp"
 //R Token1 Token2
 A()
+
+//H 10: t_1_016.cpp(13): #define
+//H 08: t_1_016.cpp(13): A=Token1 B
+//H 10: t_1_016.cpp(14): #define
+//H 08: t_1_016.cpp(14): B()=Token2
+//H 01: t_1_016.cpp(13): A
+//H 02: Token1 B
+//H 03: Token1 B
+//H 00: t_1_016.cpp(13): B(), [t_1_016.cpp(14): B()=Token2]
+//H 02: Token2
+//H 03: Token2

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_020.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_020.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_020.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -20,3 +20,15 @@
 //R B()
 A() // not 'anything'!
 
+//H 10: t_1_020.cpp(14): #define
+//H 08: t_1_020.cpp(14): NIL=
+//H 10: t_1_020.cpp(16): #define
+//H 08: t_1_020.cpp(16): A=B NIL
+//H 10: t_1_020.cpp(17): #define
+//H 08: t_1_020.cpp(17): B()=anything
+//H 01: t_1_020.cpp(16): A
+//H 02: B NIL
+//H 01: t_1_020.cpp(14): NIL
+//H 02:
+//H 03: _
+//H 03: B_

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_021.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_021.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_021.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -18,3 +18,24 @@
 //R #line 20 "t_1_021.cpp"
 //R 1 + 2 ...
 MACRO()()
+
+//H 10: t_1_021.cpp(13): #define
+//H 08: t_1_021.cpp(13): MACRO()=X + Y NEXT
+//H 10: t_1_021.cpp(14): #define
+//H 08: t_1_021.cpp(14): X=1
+//H 10: t_1_021.cpp(15): #define
+//H 08: t_1_021.cpp(15): Y=2
+//H 10: t_1_021.cpp(16): #define
+//H 08: t_1_021.cpp(16): NEXT()=...
+//H 00: t_1_021.cpp(20): MACRO(), [t_1_021.cpp(13): MACRO()=X + Y NEXT]
+//H 02: X + Y NEXT
+//H 01: t_1_021.cpp(14): X
+//H 02: 1
+//H 03: 1
+//H 01: t_1_021.cpp(15): Y
+//H 02: 2
+//H 03: 2
+//H 03: 1 + 2 NEXT
+//H 00: t_1_021.cpp(13): NEXT(), [t_1_021.cpp(16): NEXT()=...]
+//H 02: ...
+//H 03: ...

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_022.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_022.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_022.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -22,3 +22,15 @@
 //R 123
 MACRO(
 )
+
+//H 10: t_1_022.cpp(12): #define
+//H 08: t_1_022.cpp(12): MACRO()=123
+//H 00: t_1_022.cpp(16): MACRO(), [t_1_022.cpp(12): MACRO()=123]
+//H 02: 123
+//H 03: 123
+//H 00: t_1_022.cpp(19): MACRO(), [t_1_022.cpp(12): MACRO()=123]
+//H 02: 123
+//H 03: 123
+//H 00: t_1_022.cpp(23): MACRO(), [t_1_022.cpp(12): MACRO()=123]
+//H 02: 123
+//H 03: 123

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_023.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_023.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_023.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -18,3 +18,16 @@
 //R #line 20 "t_1_023.cpp"
 //R EAT_1...
 EAT(1)...
+
+//H 10: t_1_023.cpp(13): #define
+//H 08: t_1_023.cpp(13): PRIMITIVE_CAT(a, b)=a ## b
+//H 10: t_1_023.cpp(15): #define
+//H 08: t_1_023.cpp(15): EAT(n)=PRIMITIVE_CAT(EAT_, n)
+//H 10: t_1_023.cpp(16): #define
+//H 08: t_1_023.cpp(16): EAT_1(a)=
+//H 00: t_1_023.cpp(20): EAT(1), [t_1_023.cpp(15): EAT(n)=PRIMITIVE_CAT(EAT_, n)]
+//H 02: PRIMITIVE_CAT(EAT_, 1)
+//H 00: t_1_023.cpp(15): PRIMITIVE_CAT(EAT_, 1), [t_1_023.cpp(13): PRIMITIVE_CAT(a, b)=a ## b]
+//H 02: EAT_1
+//H 03: EAT_1
+//H 03: EAT_1

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_025.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_025.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_025.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -18,3 +18,18 @@
 //R #line 19 "t_1_025.cpp"
 SCAN(BUG) 1 2 3 4 5 //R 1 2 3 4 5
 
+//H 10: t_1_025.cpp(13): #define
+//H 08: t_1_025.cpp(13): SCAN(x)=x
+//H 10: t_1_025.cpp(15): #define
+//H 08: t_1_025.cpp(15): BUG=BUG_2
+//H 10: t_1_025.cpp(16): #define
+//H 08: t_1_025.cpp(16): BUG_2=
+//H 00: t_1_025.cpp(19): SCAN(BUG), [t_1_025.cpp(13): SCAN(x)=x]
+//H 01: t_1_025.cpp(15): BUG
+//H 02: BUG_2
+//H 01: t_1_025.cpp(16): BUG_2
+//H 02:
+//H 03: _
+//H 03: _
+//H 02:
+//H 03: _

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_026.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_026.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_026.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,6 @@
            // ^ ^ this is illegal
 
 MACRO(1, 2)
+
+//H 10: t_1_026.cpp(13): #define
+//H 18: boost::wave::macro_handling_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_029.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_029.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_029.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -21,3 +21,24 @@
 //R
 CAT4_1(1, 0, 0, 2) //R 1002
 CAT4_2(1, 0, 0, 2) //R 1002
+
+//H 10: t_1_029.cpp(12): #define
+//H 08: t_1_029.cpp(12): CAT3_1(a, b, c)=a##b##c
+//H 10: t_1_029.cpp(13): #define
+//H 08: t_1_029.cpp(13): CAT3_2(a, b, c)=a ## b ## c
+//H 10: t_1_029.cpp(15): #define
+//H 08: t_1_029.cpp(15): CAT4_1(a, b, c, d)=a##b##c##d
+//H 10: t_1_029.cpp(16): #define
+//H 08: t_1_029.cpp(16): CAT4_2(a, b, c, d)=a ## b ## c ## d
+//H 00: t_1_029.cpp(19): CAT3_1(1, 0, 0), [t_1_029.cpp(12): CAT3_1(a, b, c)=a##b##c]
+//H 02: 100
+//H 03: 100
+//H 00: t_1_029.cpp(20): CAT3_2(1, 0, 0), [t_1_029.cpp(13): CAT3_2(a, b, c)=a ## b ## c]
+//H 02: 100
+//H 03: 100
+//H 00: t_1_029.cpp(22): CAT4_1(1, 0, 0, 2), [t_1_029.cpp(15): CAT4_1(a, b, c, d)=a##b##c##d]
+//H 02: 1002
+//H 03: 1002
+//H 00: t_1_029.cpp(23): CAT4_2(1, 0, 0, 2), [t_1_029.cpp(16): CAT4_2(a, b, c, d)=a ## b ## c ## d]
+//H 02: 1002
+//H 03: 1002

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_030.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_030.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_030.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -15,3 +15,19 @@
 
 //R #line 17 "t_1_030.cpp"
 SCAN( MACRO EMPTY() )(1) //R (1)
+
+//H 10: t_1_030.cpp(12): #define
+//H 08: t_1_030.cpp(12): EMPTY()=
+//H 10: t_1_030.cpp(13): #define
+//H 08: t_1_030.cpp(13): SCAN(x)=x
+//H 10: t_1_030.cpp(14): #define
+//H 08: t_1_030.cpp(14): MACRO(x)=(x)
+//H 00: t_1_030.cpp(17): SCAN( MACRO EMPTY() ), [t_1_030.cpp(13): SCAN(x)=x]
+//H 00: t_1_030.cpp(17): EMPTY(), [t_1_030.cpp(12): EMPTY()=]
+//H 02:
+//H 03: _
+//H 02: MACRO
+//H 03: MACRO
+//H 00: t_1_030.cpp(17): MACRO(1), [t_1_030.cpp(14): MACRO(x)=(x)]
+//H 02: (1)
+//H 03: (1)

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_031.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_031.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_031.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -16,3 +16,12 @@
 //R #line 17 "t_1_031.cpp"
 is_empty( + ) //R is_empty_+other
 is_empty( +text ) //R is_empty_+textother
+
+//H 10: t_1_031.cpp(14): #define
+//H 08: t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other
+//H 00: t_1_031.cpp(17): is_empty( + ), [t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other]
+//H 02: is_empty_+other
+//H 03: is_empty_+other
+//H 00: t_1_031.cpp(18): is_empty( +text ), [t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other]
+//H 02: is_empty_+textother
+//H 03: is_empty_+textother

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_033.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_033.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_033.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -18,3 +18,18 @@
 STR(1,2,3) //R "1,2,3"
 STR(1 , 2 , 3) //R "1 , 2 , 3"
 STR( 1 , 2 , 3 ) //R "1 , 2 , 3"
+
+//H 10: t_1_033.cpp(14): #define
+//H 08: t_1_033.cpp(14): STR(...)=#__VA_ARGS__
+//H 00: t_1_033.cpp(17): STR(1, 2, 3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__]
+//H 02: "1, 2, 3"
+//H 03: "1, 2, 3"
+//H 00: t_1_033.cpp(18): STR(1,2,3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__]
+//H 02: "1,2,3"
+//H 03: "1,2,3"
+//H 00: t_1_033.cpp(19): STR(1 , 2 , 3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__]
+//H 02: "1 , 2 , 3"
+//H 03: "1 , 2 , 3"
+//H 00: t_1_033.cpp(20): STR( 1 , 2 , 3 ), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__]
+//H 02: "1 , 2 , 3"
+//H 03: "1 , 2 , 3"

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_034.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_034.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_034.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -19,3 +19,19 @@
 MACRO1(1,) //R 1 ->
 MACRO2(1, 2) //R 1,2
 STR() //R ""
+
+//H 10: t_1_034.cpp(14): #define
+//H 08: t_1_034.cpp(14): MACRO1(x, ...)=x -> __VA_ARGS__
+//H 10: t_1_034.cpp(15): #define
+//H 08: t_1_034.cpp(15): MACRO2(...)=__VA_ARGS__
+//H 10: t_1_034.cpp(16): #define
+//H 08: t_1_034.cpp(16): STR(...)=#__VA_ARGS__
+//H 00: t_1_034.cpp(19): MACRO1(1,§), [t_1_034.cpp(14): MACRO1(x, ...)=x -> __VA_ARGS__]
+//H 02: 1 -> §
+//H 03: 1 ->
+//H 00: t_1_034.cpp(20): MACRO2(1, 2), [t_1_034.cpp(15): MACRO2(...)=__VA_ARGS__]
+//H 02: 1,2
+//H 03: 1,2
+//H 00: t_1_034.cpp(21): STR(§), [t_1_034.cpp(16): STR(...)=#__VA_ARGS__]
+//H 02: ""
+//H 03: ""

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_035.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_035.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_035.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -22,3 +22,26 @@
 PASTE2(1, ,3,4) //R 134
 PASTE2(1,,3,4) //R 134
 PASTE2(1, , , 4) //R 14
+
+//H 10: t_1_035.cpp(14): #define
+//H 08: t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d
+//H 10: t_1_035.cpp(15): #define
+//H 08: t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d
+//H 00: t_1_035.cpp(18): PASTE1(1, §,3,4), [t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d]
+//H 02: 134
+//H 03: 134
+//H 00: t_1_035.cpp(19): PASTE1(1,§,3,4), [t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d]
+//H 02: 134
+//H 03: 134
+//H 00: t_1_035.cpp(20): PASTE1(1, §, §, 4), [t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d]
+//H 02: 14
+//H 03: 14
+//H 00: t_1_035.cpp(22): PASTE2(1, §,3,4), [t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d]
+//H 02: 134
+//H 03: 134
+//H 00: t_1_035.cpp(23): PASTE2(1,§,3,4), [t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d]
+//H 02: 134
+//H 03: 134
+//H 00: t_1_035.cpp(24): PASTE2(1, §, §, 4), [t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d]
+//H 02: 14
+//H 03: 14

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_036.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_036.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_036.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -13,3 +13,9 @@
 
 //R #line 15 "t_1_036.cpp"
 OBJECT //R ab
+
+//H 10: t_1_036.cpp(12): #define
+//H 08: t_1_036.cpp(12): OBJECT=a ## b
+//H 01: t_1_036.cpp(12): OBJECT
+//H 02: ab
+//H 03: ab

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_037.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_037.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_037.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,9 @@
 //R // bool;
 #define _VARIANT_BOOL /##/
 _VARIANT_BOOL bool;
+
+//H 10: t_1_037.cpp(15): #define
+//H 08: t_1_037.cpp(15): _VARIANT_BOOL=/##/
+//H 01: t_1_037.cpp(15): _VARIANT_BOOL
+//H 02: //
+//H 03: //

Modified: trunk/libs/wave/test/testwave/testfiles/t_1_038.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_1_038.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_1_038.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -30,3 +30,8 @@
 //R
 //R struct bar {};
 
+//H 10: t_1_038.cpp(12): #define
+//H 08: t_1_038.cpp(12): BAZ(T, E)=T E
+//H 00: t_1_038.cpp(16): BAZ(bool, value = true ), [t_1_038.cpp(12): BAZ(T, E)=T E]
+//H 02: bool value = true
+//H 03: bool value = true

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_001.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_001.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_001.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -16,3 +16,17 @@
 #define WARNING1 This is a
 #define WARNING2 warning
 #warning WARNING1 WARNING2
+
+//H 10: t_2_001.cpp(16): #define
+//H 08: t_2_001.cpp(16): WARNING1=This is a
+//H 10: t_2_001.cpp(17): #define
+//H 08: t_2_001.cpp(17): WARNING2=warning
+//H 10: t_2_001.cpp(18): #warning
+//H 01: t_2_001.cpp(16): WARNING1
+//H 02: This is a
+//H 03: This is a
+//H 01: t_2_001.cpp(17): WARNING2
+//H 02: warning
+//H 03: warning
+//H 15: WARNING1 WARNING2
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_002.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_002.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_002.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,9 @@
 //R
 //E a_nonexisting_file.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "a_nonexisting_file.cpp"
 #error This error should occur at line 8 of "a_nonexisting_file.cpp"
+
+//H 10: t_2_002.cpp(12): #line
+//H 17: 5 "a_nonexisting_file.cpp" (5, "a_nonexisting_file.cpp")
+//H 10: a_nonexisting_file.cpp(8): #error
+//H 16: This error should occur at line 8 of "a_nonexisting_file.cpp"
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_003.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_003.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_003.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,9 @@
 //R
 //E t_2_003.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "t_2_003.cpp"
 #error This error should occur at line 8 of "t_2_003.cpp"
+
+//H 10: t_2_003.cpp(12): #line
+//H 17: 5 (5, "")
+//H 10: t_2_003.cpp(8): #error
+//H 16: This error should occur at line 8 of "t_2_003.cpp"
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_004.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_004.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_004.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -16,3 +16,19 @@
 //R
 //E a_nonexisting_file.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "a_nonexisting_file.cpp"
 #error This error should occur at line 8 of "a_nonexisting_file.cpp"
+
+//H 10: t_2_004.cpp(12): #define
+//H 08: t_2_004.cpp(12): LINE_NO=5
+//H 10: t_2_004.cpp(13): #define
+//H 08: t_2_004.cpp(13): FILE_NAME="a_nonexisting_file.cpp"
+//H 10: t_2_004.cpp(14): #line
+//H 01: t_2_004.cpp(12): LINE_NO
+//H 02: 5
+//H 03: 5
+//H 01: t_2_004.cpp(13): FILE_NAME
+//H 02: "a_nonexisting_file.cpp"
+//H 03: "a_nonexisting_file.cpp"
+//H 17: 5 "a_nonexisting_file.cpp" (5, "a_nonexisting_file.cpp")
+//H 10: a_nonexisting_file.cpp(8): #error
+//H 16: This error should occur at line 8 of "a_nonexisting_file.cpp"
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_005.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_005.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_005.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -12,3 +12,5 @@
 //R
 //E t_2_005.cpp(14): error: ill formed preprocessor directive: this_is_a_unknown_pp_directive
 #this_is_a_unknown_pp_directive with some parameter
+
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_006.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_006.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_006.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -23,3 +23,16 @@
 //R #line 25 "t_2_006.cpp"
 //R #pragma STDC preprocessed pragma body
 #pragma STDC PRAGMA_BODY
+
+//H 10: t_2_006.cpp(12): #define
+//H 08: t_2_006.cpp(12): PRAGMA_BODY=preprocessed pragma body
+//H 10: t_2_006.cpp(16): #pragma
+//H 10: t_2_006.cpp(19): #pragma
+//H 01: t_2_006.cpp(12): PRAGMA_BODY
+//H 02: preprocessed pragma body
+//H 03: preprocessed pragma body
+//H 10: t_2_006.cpp(22): #pragma
+//H 10: t_2_006.cpp(25): #pragma
+//H 01: t_2_006.cpp(12): PRAGMA_BODY
+//H 02: preprocessed pragma body
+//H 03: preprocessed pragma body

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_007.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_007.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_007.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -10,7 +10,7 @@
 //O --c99
 
 // Tests correctness of macro expansion inside #pragma directives
-// Note: in C99 mode the STDC prefix in pragmas supresses macro expansion
+// Note: in C99 mode the STDC prefix in pragma's suppresses macro expansion
 
 #define PRAGMA_BODY preprocessed pragma body
 
@@ -26,3 +26,13 @@
 //R #line 28 "t_2_007.cpp"
 //R #pragma STDC PRAGMA_BODY
 #pragma STDC PRAGMA_BODY
+
+//H 10: t_2_007.cpp(15): #define
+//H 08: t_2_007.cpp(15): PRAGMA_BODY=preprocessed pragma body
+//H 10: t_2_007.cpp(19): #pragma
+//H 10: t_2_007.cpp(22): #pragma
+//H 01: t_2_007.cpp(15): PRAGMA_BODY
+//H 02: preprocessed pragma body
+//H 03: preprocessed pragma body
+//H 10: t_2_007.cpp(25): #pragma
+//H 10: t_2_007.cpp(28): #pragma

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_008.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_008.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_008.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -7,9 +7,18 @@
     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-// Tests #include statements with macros as argmuments
+// Tests #include statements with macros as arguments
 
 //R
 //E t_2_008.cpp(15): error: could not find include file: some_include_file.h
 #define INCLUDE_FILE "some_include_file.h"
 #include INCLUDE_FILE
+
+//H 10: t_2_008.cpp(14): #define
+//H 08: t_2_008.cpp(14): INCLUDE_FILE="some_include_file.h"
+//H 10: t_2_008.cpp(15): #include
+//H 01: t_2_008.cpp(14): INCLUDE_FILE
+//H 02: "some_include_file.h"
+//H 03: "some_include_file.h"
+//H 04: "some_include_file.h"
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -7,9 +7,8 @@
     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-// The result of macro expansion must be
-// retokenized to find header-name tokens
-// of either <file> or "file"
+// The result of macro expansion must be re-tokenized to find header-name
+// tokens of either <file> or "file"
 
 //O -S.
 
@@ -19,14 +18,38 @@
 #define SYSTEM_HEADER <t_2_009.cpp>
 #define USER_HEADER "t_2_009.cpp"
 
-//R #line 24 "t_2_009.cpp"
+//R #line 23 "t_2_009.cpp"
 //R including <t_2_009.cpp>
 including <t_2_009.cpp>
 #include SYSTEM_HEADER
 
-//R #line 29 "t_2_009.cpp"
+//R #line 28 "t_2_009.cpp"
 //R including "t_2_009.cpp"
 including "t_2_009.cpp"
 #include USER_HEADER
 
 #endif // FILE_002_009_CPP
+
+//H 10: t_2_009.cpp(15): #if
+//H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 1
+//H 10: t_2_009.cpp(16): #define
+//H 08: t_2_009.cpp(16): FILE_002_009_CPP=
+//H 10: t_2_009.cpp(18): #define
+//H 08: t_2_009.cpp(18): SYSTEM_HEADER=<t_2_009.cpp>
+//H 10: t_2_009.cpp(19): #define
+//H 08: t_2_009.cpp(19): USER_HEADER="t_2_009.cpp"
+//H 10: t_2_009.cpp(24): #include
+//H 01: t_2_009.cpp(18): SYSTEM_HEADER
+//H 02: <t_2_009.cpp>
+//H 03: <t_2_009.cpp>
+//H 04: <t_2_009.cpp>
+//H 05: ./t_2_009.cpp (C:/CVS/wave/libs/wave/test/testwave/testfiles/t_2_009.cpp)
+//H 10: t_2_009.cpp(15): #if
+//H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 0
+//H 06:
+//H 10: t_2_009.cpp(29): #include
+//H 01: t_2_009.cpp(19): USER_HEADER
+//H 02: "t_2_009.cpp"
+//H 03: "t_2_009.cpp"
+//H 04: "t_2_009.cpp"
+//H 10: t_2_009.cpp(31): #endif

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_010.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_010.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_010.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -9,7 +9,13 @@
 
 // Tests error reporting for missing #endif
 
-//E t_2_010.cpp(16): error: detected at least one missing #endif directive
+//E t_2_010.cpp(22): error: detected at least one missing #endif directive
 #if 1
 #if 0
 #endif
+
+//H 10: t_2_010.cpp(13): #if
+//H 11: t_2_010.cpp(13): #if 1: 1
+//H 10: t_2_010.cpp(14): #if
+//H 11: t_2_010.cpp(14): #if 0: 0
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_011.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_011.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_011.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -13,3 +13,9 @@
 #if 1
 #endif
 #endif
+
+//H 10: t_2_011.cpp(13): #if
+//H 11: t_2_011.cpp(13): #if 1: 1
+//H 10: t_2_011.cpp(14): #endif
+//H 10: t_2_011.cpp(15): #endif
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_012.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_012.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_012.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -12,3 +12,6 @@
 //E t_2_012.cpp(13): error: the #if for this directive is missing: #else
 #else
 #endif
+
+//H 10: t_2_012.cpp(13): #else
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_013.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_013.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_013.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -9,7 +9,11 @@
 
 // Tests error reporting for missing #if
 
-//E t_2_013.cpp(16): error: detected at least one missing #endif directive
+//E t_2_013.cpp(20): error: detected at least one missing #endif directive
 #if 1
 #else
 
+//H 10: t_2_013.cpp(13): #if
+//H 11: t_2_013.cpp(13): #if 1: 1
+//H 10: t_2_013.cpp(14): #else
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_014.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_014.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_014.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -81,3 +81,31 @@
 #else
 false
 #endif
+
+//H 10: t_2_014.cpp(15): #if
+//H 11: t_2_014.cpp(15): #if compl 1: 1
+//H 10: t_2_014.cpp(17): #else
+//H 10: t_2_014.cpp(23): #if
+//H 11: t_2_014.cpp(23): #if not 1: 0
+//H 10: t_2_014.cpp(27): #endif
+//H 10: t_2_014.cpp(31): #if
+//H 11: t_2_014.cpp(31): #if 1 or 2: 1
+//H 10: t_2_014.cpp(33): #else
+//H 10: t_2_014.cpp(39): #if
+//H 11: t_2_014.cpp(39): #if 1 and 2: 1
+//H 10: t_2_014.cpp(41): #else
+//H 10: t_2_014.cpp(47): #if
+//H 11: t_2_014.cpp(47): #if not 1: 0
+//H 10: t_2_014.cpp(51): #endif
+//H 10: t_2_014.cpp(55): #if
+//H 11: t_2_014.cpp(55): #if 1 xor 2: 1
+//H 10: t_2_014.cpp(57): #else
+//H 10: t_2_014.cpp(63): #if
+//H 11: t_2_014.cpp(63): #if 1 bitand 2: 0
+//H 10: t_2_014.cpp(67): #endif
+//H 10: t_2_014.cpp(71): #if
+//H 11: t_2_014.cpp(71): #if 1 bitor 2: 1
+//H 10: t_2_014.cpp(73): #else
+//H 10: t_2_014.cpp(79): #if
+//H 11: t_2_014.cpp(79): #if 1 not_eq 2: 1
+//H 10: t_2_014.cpp(81): #else

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_015.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_015.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_015.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -7,7 +7,7 @@
     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-// Tests, whether #if works when the expression is surrounded by paranthesis
+// Tests, whether #if works when the expression is surrounded by parenthesis
 
 #define WINVER 0x0500
 
@@ -16,3 +16,12 @@
 #if(WINVER >= 0x0500)
 true
 #endif
+
+//H 10: t_2_015.cpp(12): #define
+//H 08: t_2_015.cpp(12): WINVER=0x0500
+//H 10: t_2_015.cpp(16): #if
+//H 01: t_2_015.cpp(12): WINVER
+//H 02: 0x0500
+//H 03: 0x0500
+//H 11: t_2_015.cpp(16): #if (WINVER >= 0x0500): 1
+//H 10: t_2_015.cpp(18): #endif

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_016.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_016.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_016.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,10 @@
 #if defined (_MSC_VER) && (_MSC_VER >= 1020)
 true
 #endif
+
+//H 10: t_2_016.cpp(17): #if
+//H 01: <command line>(1): _MSC_VER
+//H 02: 1200
+//H 03: 1200
+//H 11: t_2_016.cpp(17): #if defined (_MSC_VER) && (_MSC_VER >= 1020): 1
+//H 10: t_2_016.cpp(19): #endif

Modified: trunk/libs/wave/test/testwave/testfiles/t_2_017.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_017.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_017.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -22,3 +22,15 @@
 //R #line 24 "t_2_017.cpp"
 //R file t_2_017.cpp
 file t_2_017.cpp
+
+//H 10: t_2_017.cpp(13): #if
+//H 11: t_2_017.cpp(13): #if !defined(FILE_002_017_CPP) : 1
+//H 10: t_2_017.cpp(14): #define
+//H 08: t_2_017.cpp(14): FILE_002_017_CPP=
+//H 10: t_2_017.cpp(16): #include
+//H 04: "$P(t_2_017.cpp)"
+//H 05: $B(t_2_017.cpp) ($B(t_2_017.cpp))
+//H 10: t_2_017.cpp(13): #if
+//H 11: t_2_017.cpp(13): #if !defined(FILE_002_017_CPP) : 0
+//H 06:
+//H 10: t_2_017.cpp(18): #endif

Modified: trunk/libs/wave/test/testwave/testfiles/t_3_001.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_3_001.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_3_001.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -12,3 +12,6 @@
 //R
 //E t_3_001.cpp(14): warning: #undef may not be used on this predefined name: __cplusplus
 #undef __cplusplus // should emit a warning
+
+//H 10: t_3_001.cpp(14): #undef
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_3_002.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_3_002.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_3_002.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -15,7 +15,7 @@
 __cplusplus //R 199711L
 __STDC_HOSTED__ //R __STDC_HOSTED__
 __LINE__ //R 17
-__FILE__ //R "$F"
+__FILE__ //R "$P"
 __BASE_FILE__ //R "$F"
 __WAVE_HAS_VARIADICS__ //R __WAVE_HAS_VARIADICS__
 __INCLUDE_LEVEL__ //R 0
@@ -31,3 +31,20 @@
 __FILE__ //R "test.cpp"
 __BASE_FILE__ //R "$F"
 
+//H 01: <built-in>(1): __STDC__
+//H 02: 1
+//H 03: 1
+//H 01: <built-in>(1): __cplusplus
+//H 02: 199711L
+//H 03: 199711L
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"
+//H 10: t_3_002.cpp(23): #line
+//H 17: 50 "test.cpp" (50, "test.cpp")
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"

Modified: trunk/libs/wave/test/testwave/testfiles/t_3_003.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_3_003.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_3_003.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,7 +17,7 @@
 __cplusplus //R 199711L
 __STDC_HOSTED__ //R __STDC_HOSTED__
 __LINE__ //R 19
-__FILE__ //R "$F"
+__FILE__ //R "$P"
 __BASE_FILE__ //R "$F"
 __WAVE_HAS_VARIADICS__ //R 1
 __INCLUDE_LEVEL__ //R 0
@@ -33,3 +33,23 @@
 __FILE__ //R "test.cpp"
 __BASE_FILE__ //R "$F"
 
+//H 01: <built-in>(1): __STDC__
+//H 02: 1
+//H 03: 1
+//H 01: <built-in>(1): __cplusplus
+//H 02: 199711L
+//H 03: 199711L
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"
+//H 01: <built-in>(1): __WAVE_HAS_VARIADICS__
+//H 02: 1
+//H 03: 1
+//H 10: t_3_003.cpp(25): #line
+//H 17: 50 "test.cpp" (50, "test.cpp")
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"

Modified: trunk/libs/wave/test/testwave/testfiles/t_3_004.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_3_004.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_3_004.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,7 +17,7 @@
 __cplusplus //R __cplusplus
 __STDC_HOSTED__ //R 0
 __LINE__ //R 19
-__FILE__ //R "$F"
+__FILE__ //R "$P"
 __BASE_FILE__ //R "$F"
 __WAVE_HAS_VARIADICS__ //R 1
 __INCLUDE_LEVEL__ //R 0
@@ -33,3 +33,26 @@
 __FILE__ //R "test.cpp"
 __BASE_FILE__ //R "$F"
 
+//H 01: <built-in>(1): __STDC__
+//H 02: 1
+//H 03: 1
+//H 01: <built-in>(1): __STDC_VERSION__
+//H 02: 199901L
+//H 03: 199901L
+//H 01: <built-in>(1): __STDC_HOSTED__
+//H 02: 0
+//H 03: 0
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"
+//H 01: <built-in>(1): __WAVE_HAS_VARIADICS__
+//H 02: 1
+//H 03: 1
+//H 10: t_3_004.cpp(25): #line
+//H 17: 50 "test.cpp" (50, "test.cpp")
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"
+//H 01: <built-in>(1): __BASE_FILE__
+//H 02: "$F"
+//H 03: "$F"

Modified: trunk/libs/wave/test/testwave/testfiles/t_4_001.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_4_001.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_4_001.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -16,3 +16,7 @@
 #else
 false
 #endif
+
+//H 10: t_4_001.cpp(14): #if
+//H 11: t_4_001.cpp(14): #if 1 / 10 == 0: 1
+//H 10: t_4_001.cpp(16): #else

Modified: trunk/libs/wave/test/testwave/testfiles/t_4_002.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_4_002.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_4_002.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,12 @@
 #if !C
 true
 #endif
+
+//H 10: t_4_002.cpp(13): #define
+//H 08: t_4_002.cpp(13): C=C
+//H 10: t_4_002.cpp(17): #if
+//H 01: t_4_002.cpp(13): C
+//H 02: C
+//H 03: C
+//H 11: t_4_002.cpp(17): #if !C: 1
+//H 10: t_4_002.cpp(19): #endif

Modified: trunk/libs/wave/test/testwave/testfiles/t_4_004.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_4_004.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_4_004.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -33,3 +33,29 @@
 #else
 false
 #endif
+
+//H 10: t_4_004.cpp(12): #define
+//H 08: t_4_004.cpp(12): USHRT_MAX=0xffffU
+//H 10: t_4_004.cpp(15): # if
+//H 11: t_4_004.cpp(15): # if !defined (SIZEOF_SHORT): 1
+//H 10: t_4_004.cpp(16): # if
+//H 01: t_4_004.cpp(12): USHRT_MAX
+//H 02: 0xffffU
+//H 03: 0xffffU
+//H 11: t_4_004.cpp(16): # if (USHRT_MAX) == 255U: 0
+//H 10: t_4_004.cpp(18): # elif
+//H 01: t_4_004.cpp(12): USHRT_MAX
+//H 02: 0xffffU
+//H 03: 0xffffU
+//H 11: t_4_004.cpp(18): # elif (USHRT_MAX) == 65535U: 1
+//H 10: t_4_004.cpp(19): #define
+//H 08: t_4_004.cpp(19): SIZEOF_SHORT=2
+//H 10: t_4_004.cpp(20): # elif
+//H 10: t_4_004.cpp(22): # elif
+//H 10: t_4_004.cpp(27): # endif
+//H 10: t_4_004.cpp(31): #if
+//H 01: t_4_004.cpp(19): SIZEOF_SHORT
+//H 02: 2
+//H 03: 2
+//H 11: t_4_004.cpp(31): #if SIZEOF_SHORT == 2: 1
+//H 10: t_4_004.cpp(33): #else

Modified: trunk/libs/wave/test/testwave/testfiles/t_5_030.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_5_030.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_5_030.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -15,7 +15,7 @@
 
 // Tests whether rescanning of a macro replace any macro call in the replacement
 // text after substitution of parameters by pre-expanded-arguments. This
-// re-examination may involve the succeding sequences from the source
+// re-examination may involve the succeeding sequences from the source
 // file (what a queer thing!).
 
 // Note: The tests 27.4 and 27.5 are currently disabled because of Wave's
@@ -57,7 +57,7 @@
 // 27.5: Queer thing.
 // R #line 28 "t_5_030.cpp"
 //#define HEAD SUB(
-//HEAD a,b ) // R
+// HEAD a,b ) // R
 
 // 27.6: Recursive macro.
 //R #line 66 "t_5_030.cpp"

Modified: trunk/libs/wave/test/testwave/testfiles/t_6_063.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_6_063.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_6_063.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -22,6 +22,11 @@
 //R #line 19 "t_6_063.hpp"
 //R int dummy = 0;
 
+//H 10: t_6_063.cpp(20): #include "t_6_063.hpp"
+//H 04: "t_6_063.hpp"
+//H 05: $B(t_6_063.hpp) ($B(t_6_063.hpp))
+//H 18: boost::wave::preprocess_exception
+
 /*-
  * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui_at_[hidden]>
  * All rights reserved.

Modified: trunk/libs/wave/test/testwave/testfiles/t_6_067.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_6_067.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_6_067.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -22,6 +22,11 @@
 //R #line 19 "t_6_067.hpp"
 //R int dummy = 0;
 
+//H 10: t_6_067.cpp(20): #include "t_6_067.hpp"
+//H 04: "t_6_067.hpp"
+//H 05: $B(t_6_067.hpp) ($B(t_6_067.hpp))
+//H 18: boost::wave::lexing_exception
+
 /*-
  * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui_at_[hidden]>
  * All rights reserved.

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_001.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_001.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_001.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -18,3 +18,6 @@
     void exposed() {} //R void exposed() {}
 #endif
 
+//H 10: t_9_001.cpp(16): #if
+//H 11: t_9_001.cpp(16): #if 1: 1
+//H 10: t_9_001.cpp(19): #endif

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_002.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_002.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_002.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -18,3 +18,6 @@
 1
 //R #line 18 "t_9_002.cpp"
 //R 1
+
+//H 10: t_9_002.cpp(10): #if
+//H 11: t_9_002.cpp(10): #if 0: 0

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -35,3 +35,18 @@
 //R
 DOT()DOT()DOT() //R .. .
 STRINGIZE( DOT()DOT()DOT() ) //R "..."
+
+// the following are regressions reported by Stefan Seefeld
+#define COMMA() ,
+#define AND() &
+#define CHAR() char
+#define STAR() *
+
+// Make sure no whitespace gets inserted in between the operator symbols
+//R #line 47 "t_9_003.cpp"
+void foo(char&, char) //R void foo(char&, char)
+void foo(char *) //R void foo(char *)
+void foo(char *&) //R void foo(char *&)
+void foo(CHAR()AND()COMMA() CHAR()) //R void foo(char&, char)
+void foo(CHAR() STAR()) //R void foo(char *)
+void foo(CHAR() STAR()AND()) //R void foo(char *&)

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_004.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_004.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_004.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -19,3 +19,10 @@
 #define \u0061 weird // 0x61 == 'a'
 
 \u0061
+
+//H 10: t_9_004.cpp(12): #define
+//H 08: t_9_004.cpp(12): \u00ff=...
+//H 01: t_9_004.cpp(12): \u00ff
+//H 02: ...
+//H 03: ...
+//H 18: boost::wave::lexing_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_006.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_006.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_006.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -36,3 +36,11 @@
 "X" is not defined.
 #endif
 
+//H 10: t_9_006.cpp(21): #define
+//H 08: t_9_006.cpp(21): X=
+//H 10: t_9_006.cpp(25): #if
+//H 11: t_9_006.cpp(25): #if defined(X): 1
+//H 10: t_9_006.cpp(27): #else
+//H 10: t_9_006.cpp(33): #if
+//H 11: t_9_006.cpp(33): #if defined X: 1
+//H 10: t_9_006.cpp(35): #else

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_007.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_007.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_007.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -7,7 +7,7 @@
     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-// Test error reproting during redefinition of 'defined'
+// Test error reporting during redefinition of 'defined'
 
 //E t_9_007.cpp(13): warning: this predefined name may not be redefined: defined
 #define defined 1 // undefined in C++ (16.8/3), error in C99 (6.10.8/4)
@@ -15,3 +15,6 @@
 #if defined // error
 <error>
 #endif
+
+//H 10: t_9_007.cpp(13): #define
+//H 18: boost::wave::macro_handling_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_008.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_008.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_008.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -7,7 +7,10 @@
     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-// Test error reproting during redefinition of 'defined'
+// Test error reporting during redefinition of 'defined'
 
 //E t_9_008.cpp(13): warning: #undef may not be used on this predefined name: defined
 #undef defined
+
+//H 10: t_9_008.cpp(13): #undef
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_009.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_009.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_009.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -14,3 +14,14 @@
 
 //R #line 16 "t_9_009.cpp"
 X() //R ...
+
+//H 10: t_9_009.cpp(12): #define
+//H 08: t_9_009.cpp(12): X()=X_ ## 0R()
+//H 10: t_9_009.cpp(13): #define
+//H 08: t_9_009.cpp(13): X_0R()=...
+//H 00: t_9_009.cpp(16): X(), [t_9_009.cpp(12): X()=X_ ## 0R()]
+//H 02: X_0R()
+//H 00: t_9_009.cpp(12): X_0R(), [t_9_009.cpp(13): X_0R()=...]
+//H 02: ...
+//H 03: ...
+//H 03: ...

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_010.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_010.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_010.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -27,3 +27,44 @@
 //R #line 28 "t_9_010.cpp"
 CAT(A, X() C) //R AB C
 CAT(A, X()C) //R AB C
+
+//H 10: t_9_010.cpp(13): #define
+//H 08: t_9_010.cpp(13): A(x)=x
+//H 00: t_9_010.cpp(16): A(1), [t_9_010.cpp(13): A(x)=x]
+//H 02: 1
+//H 03: 1
+//H 00: t_9_010.cpp(17): A(1), [t_9_010.cpp(13): A(x)=x]
+//H 02: 1
+//H 03: 1
+//H 00: t_9_010.cpp(18): A(X), [t_9_010.cpp(13): A(x)=x]
+//H 02: X
+//H 03: X
+//H 00: t_9_010.cpp(19): A(X), [t_9_010.cpp(13): A(x)=x]
+//H 02: X
+//H 03: X
+//H 10: t_9_010.cpp(21): #define
+//H 08: t_9_010.cpp(21): CAT(a, b)=PRIMITIVE_CAT(a, b)
+//H 10: t_9_010.cpp(22): #define
+//H 08: t_9_010.cpp(22): PRIMITIVE_CAT(a, b)=a ## b
+//H 10: t_9_010.cpp(24): #define
+//H 08: t_9_010.cpp(24): X()=B
+//H 10: t_9_010.cpp(25): #define
+//H 08: t_9_010.cpp(25): ABC=1
+//H 00: t_9_010.cpp(28): CAT(A, X() C), [t_9_010.cpp(21): CAT(a, b)=PRIMITIVE_CAT(a, b)]
+//H 00: t_9_010.cpp(28): X(), [t_9_010.cpp(24): X()=B]
+//H 02: B
+//H 03: B
+//H 02: PRIMITIVE_CAT(A, B C)
+//H 00: t_9_010.cpp(21): PRIMITIVE_CAT(A, B C), [t_9_010.cpp(22): PRIMITIVE_CAT(a, b)=a ## b]
+//H 02: AB C
+//H 03: AB C
+//H 03: AB C
+//H 00: t_9_010.cpp(29): CAT(A, X()C), [t_9_010.cpp(21): CAT(a, b)=PRIMITIVE_CAT(a, b)]
+//H 00: t_9_010.cpp(29): X(), [t_9_010.cpp(24): X()=B]
+//H 02: B
+//H 03: B
+//H 02: PRIMITIVE_CAT(A, BC)
+//H 00: t_9_010.cpp(21): PRIMITIVE_CAT(A, BC), [t_9_010.cpp(22): PRIMITIVE_CAT(a, b)=a ## b]
+//H 02: ABC
+//H 03: ABC
+//H 03: ABC

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_011.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_011.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_011.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,14 @@
 //R #line 18 "t_9_011.cpp"
 PRIMITIVE_CAT(1, ABC) //R 1 ABC
 PRIMITIVE_CAT3(ABC, 1, ABC) //R ABC1ABC
+
+//H 10: t_9_011.cpp(14): #define
+//H 08: t_9_011.cpp(14): PRIMITIVE_CAT(a, b)=a ## b
+//H 10: t_9_011.cpp(15): #define
+//H 08: t_9_011.cpp(15): PRIMITIVE_CAT3(a, b, c)=a ## b ## c
+//H 00: t_9_011.cpp(18): PRIMITIVE_CAT(1, ABC), [t_9_011.cpp(14): PRIMITIVE_CAT(a, b)=a ## b]
+//H 02: 1ABC
+//H 03: 1ABC
+//H 00: t_9_011.cpp(19): PRIMITIVE_CAT3(ABC, 1, ABC), [t_9_011.cpp(15): PRIMITIVE_CAT3(a, b, c)=a ## b ## c]
+//H 02: ABC1ABC
+//H 03: ABC1ABC

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_012.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_012.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_012.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,9 @@
 
 //R #line 19 "t_9_012.cpp"
 CreateWindowA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) //R CreateWindowExA(0L, 1, 2, 3, 4, 5,6, 7, 8, 9, 10, 11)
+
+//H 10: t_9_012.cpp(13): #define
+//H 08: t_9_012.cpp(13): CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)=CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
+//H 00: t_9_012.cpp(19): CreateWindowA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [t_9_012.cpp(13): CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)=CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)]
+//H 02: CreateWindowExA(0L, 1, 2, 3, 4, 5,6, 7, 8, 9, 10, 11)
+//H 03: CreateWindowExA(0L, 1, 2, 3, 4, 5,6, 7, 8, 9, 10, 11)

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_013.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_013.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_013.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -13,3 +13,7 @@
 
 //E t_9_013.cpp(15): warning: empty macro arguments are not supported in pure C++ mode, use variadics mode to allow these: MACRO
 MACRO(1,, 3)
+
+//H 10: t_9_013.cpp(12): #define
+//H 08: t_9_013.cpp(12): MACRO(a, b, c)=a ## b ## c
+//H 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -17,3 +17,25 @@
 #define EXPAND(x) x
 EXPAND(#) define later
 #endif
+
+//H 10: t_9_016.cpp(10): #if
+//H 11: t_9_016.cpp(10): #if !defined(inclusion): 1
+//H 10: t_9_016.cpp(11): #define
+//H 08: t_9_016.cpp(11): inclusion=
+//H 10: t_9_016.cpp(12): # include
+//H 04: "$P(t_9_016.cpp)"
+//H 05: $B(t_9_016.cpp) ($B(t_9_016.cpp))
+//H 10: t_9_016.cpp(10): #if
+//H 11: t_9_016.cpp(10): #if !defined(inclusion): 0
+//H 10: t_9_016.cpp(17): #define
+//H 08: t_9_016.cpp(17): EXPAND(x)=x
+//H 00: t_9_016.cpp(18): EXPAND(#), [t_9_016.cpp(17): EXPAND(x)=x]
+//H 02: #
+//H 03: #
+//H 10: t_9_016.cpp(19): #endif
+//H 06:
+//H 10: t_9_016.cpp(13): # include "t_9_016.hpp"
+//H 04: "t_9_016.hpp"
+//H 05: $B(t_9_016.hpp) ($B(t_9_016.hpp))
+//H 06:
+//H 10: t_9_016.cpp(14): #else

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_017.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_017.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_017.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -46,3 +46,30 @@
 #else
 false is defined
 #endif
+
+//H 10: t_9_017.cpp(12): #define
+//H 08: t_9_017.cpp(12): true=1
+//H 10: t_9_017.cpp(13): #define
+//H 08: t_9_017.cpp(13): false=0
+//H 10: t_9_017.cpp(17): #if
+//H 11: t_9_017.cpp(17): #if defined(true): 1
+//H 01: t_9_017.cpp(12): true
+//H 02: 1
+//H 03: 1
+//H 10: t_9_017.cpp(19): #else
+//H 10: t_9_017.cpp(25): #if
+//H 11: t_9_017.cpp(25): #if defined(false): 1
+//H 01: t_9_017.cpp(13): false
+//H 02: 0
+//H 03: 0
+//H 10: t_9_017.cpp(27): #else
+//H 10: t_9_017.cpp(31): #undef
+//H 09: t_9_017.cpp(31): true
+//H 10: t_9_017.cpp(32): #undef
+//H 09: t_9_017.cpp(32): false
+//H 10: t_9_017.cpp(36): #ifndef
+//H 11: t_9_017.cpp(36): #ifndef true: 0
+//H 10: t_9_017.cpp(38): #else
+//H 10: t_9_017.cpp(44): #ifndef
+//H 11: t_9_017.cpp(44): #ifndef false: 0
+//H 10: t_9_017.cpp(46): #else

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_018.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_018.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_018.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -13,3 +13,8 @@
 //E t_9_018.cpp(15): warning: illegal macro redefinition: M1
 #define M1 1
 #define M1
+
+//H 10: t_9_018.cpp(14): #define
+//H 08: t_9_018.cpp(14): M1=1
+//H 10: t_9_018.cpp(15): #define
+//H 18: boost::wave::macro_handling_exception

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_019.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_019.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_019.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -13,3 +13,9 @@
 //E t_9_019.hpp(11): error: could not find include file: t_9_019.hpp
 #include "t_9_019.hpp"
 
+// 10: t_9_019.cpp(14): #include "t_9_019.hpp"
+// 04: "t_9_019.hpp"
+// 05: $B(t_9_019.hpp) ($B(t_9_019.hpp))
+// 10: t_9_019.hpp(11): #include_next "t_9_019.hpp"
+// 04: "t_9_019.hpp" (include_next)
+// 18: boost::wave::preprocess_exception

Modified: trunk/libs/wave/test/testwave/testwave.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave.cpp (original)
+++ trunk/libs/wave/test/testwave/testwave.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -37,6 +37,8 @@
 // level 3: prints the expected and real result for failed tests
 // level 4: prints the outcome of every test
 // level 5: prints the real result even for succeeded tests
+// level 6: prints the real hooks information recorded, even for succeeded
+// tests
 //
 // level 9: prints information about almost everything
 //

Modified: trunk/libs/wave/test/testwave/testwave_app.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave_app.cpp (original)
+++ trunk/libs/wave/test/testwave/testwave_app.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -20,6 +20,10 @@
 #include <boost/detail/workaround.hpp>
 
 // include Wave
+
+// always use new hooks
+#define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 0
+
 #include <boost/wave.hpp>
 
 // include the lexer related stuff
@@ -29,6 +33,7 @@
 // test application related headers
 #include "cmd_line_utils.hpp"
 #include "testwave_app.hpp"
+#include "collect_hooks_information.hpp"
 
 namespace po = boost::program_options;
 namespace fs = boost::filesystem;
@@ -36,27 +41,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 // testwave version definitions
 #define TESTWAVE_VERSION_MAJOR 0
-#define TESTWAVE_VERSION_MINOR 4
+#define TESTWAVE_VERSION_MINOR 5
 #define TESTWAVE_VERSION_SUBMINOR 0
 
-///////////////////////////////////////////////////////////////////////////////
-// workaround for missing ostringstream
-#ifdef BOOST_NO_STRINGSTREAM
-#include <strstream>
-#define BOOST_WAVETEST_OSSTREAM std::ostrstream
-std::string BOOST_WAVETEST_GETSTRING(std::ostrstream& ss)
-{
- ss << ends;
- std::string rval = ss.str();
- ss.freeze(false);
- return rval;
-}
-#else
-#include <sstream>
-#define BOOST_WAVETEST_GETSTRING(ss) ss.str()
-#define BOOST_WAVETEST_OSSTREAM std::ostringstream
-#endif
-
 namespace {
 
     ///////////////////////////////////////////////////////////////////////////
@@ -86,19 +73,6 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename String>
- String const& handle_filepath(String &name)
- {
- using boost::wave::util::impl::unescape_lit;
-
- String unesc_name = unescape_lit(name);
- fs::path p (unesc_name.c_str(), fs::native);
-
- name = p.leaf().c_str();
- return name;
- }
-
- ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator>
     bool handle_line_directive(Iterator &it, Iterator const& end,
         std::string &result)
@@ -128,10 +102,11 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // This function compares the real result and the expected one but first
-// replaces all occurences in the expected result of
+// replaces all occurrences in the expected result of
 // $E: to the result of preprocessing the given expression
 // $F: to the passed full filepath
 // $P: to the full path
+// $B: to the full path (but using forward slahs '/' on Windows)
 // $V: to the current Boost version number
 //
 ///////////////////////////////////////////////////////////////////////////
@@ -159,9 +134,9 @@
                             return false;
                         }
                         std::string source = expected.substr(pos1+3, p-pos1-3);
- std::string result, error;
+ std::string result, error, hooks;
                         bool pp_result = preprocess_file(filename, source,
- result, error, true);
+ result, error, hooks, true);
                         if (!pp_result) {
                             std::cerr
                                 << "testwave: preprocessing error in $E directive: "
@@ -183,10 +158,12 @@
                 break;
 
             case 'P': // insert full path
+ case 'B': // same as 'P', but forward slashs on Windows
                 {
                     fs::path fullpath = fs::complete(
                         fs::path(filename, fs::native),
                         fs::current_path());
+
                     if ('(' == expected[pos1+2]) {
                     // the $P(basename) syntax is used
                         std::size_t p = expected.find_first_of(")", pos1+1);
@@ -199,17 +176,29 @@
                         std::string base = expected.substr(pos1+3, p-pos1-3);
                         fullpath = fullpath.branch_path() /
                             fs::path(base, fs::native);
- full_result = full_result +
- expected.substr(pos, pos1-pos) +
- escape_lit(fullpath.normalize().native_file_string());
+ full_result += expected.substr(pos, pos1-pos);
+ if ('P' == expected[pos1+1]) {
+ full_result +=
+ escape_lit(fullpath.normalize().native_file_string());
+ }
+ else {
+ full_result +=
+ escape_lit(fullpath.normalize().string());
+ }
                         pos1 = expected.find_first_of ("$",
                             pos = pos1 + 4 + base.size());
                     }
                     else {
                     // the $P is used on its own
- full_result = full_result +
- expected.substr(pos, pos1-pos) +
- escape_lit(fullpath.native_file_string());
+ full_result += expected.substr(pos, pos1-pos);
+ if ('P' == expected[pos1+1]) {
+ full_result +=
+ escape_lit(fullpath.native_file_string());
+ }
+ else {
+ full_result +=
+ escape_lit(fullpath.string());
+ }
                         pos1 = expected.find_first_of ("$", pos = pos1 + 2);
                     }
                 }
@@ -273,7 +262,8 @@
 //
 // Test the given file (i.e. preprocess the file and compare the result
 // against the embedded 'R' comments, if an error occurs compare the error
-// message against the given 'E' comments).
+// message against the given 'E' comments, if no error occurred, compare the
+// generated hooks result against the given 'H' comments).
 //
 ///////////////////////////////////////////////////////////////////////////////
 bool
@@ -285,11 +275,12 @@
         return false; // error was reported already
 
 // extract expected output, preprocess the data and compare results
- std::string expected;
- if (extract_expected_output(filename, instr, expected)) {
+ std::string expected, expected_hooks;
+ if (extract_expected_output(filename, instr, expected, expected_hooks)) {
         bool retval = true; // assume success
- std::string result, error;
- bool pp_result = preprocess_file(filename, instr, result, error);
+ bool printed_result = false;
+ std::string result, error, hooks;
+ bool pp_result = preprocess_file(filename, instr, result, error, hooks);
         if (pp_result || !result.empty()) {
         // did we expect an error?
             std::string expected_error;
@@ -332,13 +323,42 @@
                 }
                 retval = false;
             }
- else if (debuglevel > 4) {
- std::cerr
- << filename << ": succeeded" << std::endl
- << "result: " << std::endl << result << std::endl;
+ else {
+ // preprocessing succeeded, check hook information, if appropriate
+ if (!expected_hooks.empty() &&
+ !got_expected_result(filename, hooks, expected_hooks))
+ {
+ if (debuglevel > 2) {
+ std::cerr << filename << ": failed" << std::endl
+ << "hooks result: " << std::endl << hooks
+ << std::endl;
+ std::cerr << "expected hooks result: " << std::endl
+ << expected_hooks << std::endl;
+ }
+ else if (debuglevel > 1) {
+ std::cerr << filename << ": failed" << std::endl;
+ }
+ retval = false;
+ }
             }
- else if (debuglevel > 3) {
- std::cerr << filename << ": succeeded" << std::endl;
+
+ // print success message, if appropriate
+ if (retval) {
+ if (debuglevel > 5) {
+ std::cerr
+ << filename << ": succeeded" << std::endl
+ << "result: " << std::endl << result << std::endl
+ << "hooks result: " << std::endl << hooks << std::endl;
+ }
+ else if (debuglevel > 4) {
+ std::cerr
+ << filename << ": succeeded" << std::endl
+ << "result: " << std::endl << result << std::endl;
+ }
+ else if (debuglevel > 3) {
+ std::cerr << filename << ": succeeded" << std::endl;
+ }
+ printed_result = true;
             }
         }
         
@@ -356,7 +376,7 @@
 
                     if (!expected_error.empty()) {
                         std::cerr
- << "result: " << std::endl << error << std::endl
+ << "error result: " << std::endl << error << std::endl
                             << "expected error: " << std::endl
                             << expected_error << std::endl;
                     }
@@ -369,14 +389,30 @@
                 }
                 retval = false;
             }
- else if (debuglevel > 4) {
- std::cerr
- << filename << ": succeeded" << std::endl
- << "result: " << std::endl << error << std::endl;
- }
- else if (debuglevel > 3) {
- // caught the expected error message
- std::cerr << filename << ": succeeded" << std::endl;
+
+ if (retval) {
+ if (debuglevel > 5) {
+ std::cerr
+ << filename << ": succeeded (caught expected error)"
+ << std::endl << "error result: " << std::endl << error
+ << std::endl;
+
+ if (!printed_result) {
+ std::cerr
+ << "hooks result: " << std::endl << hooks
+ << std::endl;
+ }
+ }
+ else if (debuglevel > 4) {
+ std::cerr
+ << filename << ": succeeded (caught expected error)"
+ << std::endl << "error result: " << std::endl << error
+ << std::endl;
+ }
+ else if (debuglevel > 3) {
+ // caught the expected error message
+ std::cerr << filename << ": succeeded" << std::endl;
+ }
             }
         }
         return retval;
@@ -552,9 +588,9 @@
                             return false;
                         }
                         std::string source = value.substr(4, p-4);
- std::string result, error;
+ std::string result, error, hooks;
                         bool pp_result = preprocess_file(filename, source,
- result, error, true);
+ result, error, hooks, true);
                         if (!pp_result) {
                             std::cerr
                                 << "testwave: preprocessing error in '" << flag
@@ -598,9 +634,9 @@
                             return false;
                         }
                         std::string source = value.substr(4, p-4);
- std::string result, error;
+ std::string result, error, hooks;
                         bool pp_result = preprocess_file(filename, source,
- result, error, true);
+ result, error, hooks, true);
                         if (!pp_result) {
                             std::cerr
                                 << "testwave: preprocessing error in '" << flag
@@ -660,9 +696,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 inline bool
 testwave_app::extract_expected_output(std::string const& filename,
- std::string const& instr, std::string& expected)
+ std::string const& instr, std::string& expected, std::string& expectedhooks)
 {
- return extract_special_information(filename, instr, 'R', expected);
+ return extract_special_information(filename, instr, 'R', expected) &&
+ extract_special_information(filename, instr, 'H', expectedhooks);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -873,7 +910,7 @@
                 std::cerr << "initialise_options: option: -D" << *cit
                           << std::endl;
             }
- ctx.add_macro_definition(*cit);
+ ctx.add_macro_definition(*cit, true);
         }
     }
 
@@ -889,7 +926,7 @@
                 std::cerr << "initialise_options: option: -P" << *cit
                           << std::endl;
             }
- ctx.add_macro_definition(*cit);
+ ctx.add_macro_definition(*cit, true);
         }
     }
 
@@ -941,7 +978,7 @@
     strm << "__TESTWAVE_SIZEOF_" << name << "__=" << value;
 
     std::string macro(BOOST_WAVETEST_GETSTRING(strm));
- if (!ctx.add_macro_definition(macro)) {
+ if (!ctx.add_macro_definition(macro, true)) {
         std::cerr << "testwave: failed to predefine macro: " << macro
                   << std::endl;
         return false;
@@ -970,7 +1007,7 @@
     }
     
     std::string macro(BOOST_WAVETEST_GETSTRING(strm));
- if (!ctx.add_macro_definition(macro)) {
+ if (!ctx.add_macro_definition(macro, true)) {
         std::cerr << "testwave: failed to predefine macro: " << macro
                   << std::endl;
         return false;
@@ -999,7 +1036,7 @@
     }
     
     std::string macro(BOOST_WAVETEST_GETSTRING(strm));
- if (!ctx.add_macro_definition(macro)) {
+ if (!ctx.add_macro_definition(macro, true)) {
         std::cerr << "testwave: failed to predefine macro: " << macro
                   << std::endl;
         return false;
@@ -1017,7 +1054,7 @@
 testwave_app::add_strict_lexer_definition(Context& ctx)
 {
     std::string macro("__TESTWAVE_HAS_STRICT_LEXER__=1");
- if (!ctx.add_macro_definition(macro)) {
+ if (!ctx.add_macro_definition(macro, true)) {
         std::cerr << "testwave: failed to predefine macro: " << macro
                   << std::endl;
         return false;
@@ -1106,14 +1143,18 @@
 ///////////////////////////////////////////////////////////////////////////////
 bool
 testwave_app::preprocess_file(std::string filename, std::string const& instr,
- std::string& result, std::string& error, bool single_line)
+ std::string& result, std::string& error, std::string& hooks,
+ bool single_line)
 {
 // create the wave::context object and initialize it from the file to
 // preprocess (may contain options inside of special comments)
     typedef boost::wave::cpplexer::lex_token<> token_type;
     typedef boost::wave::cpplexer::lex_iterator<token_type> lexer_type;
- typedef boost::wave::context<std::string::const_iterator, lexer_type>
- context_type;
+ typedef boost::wave::context<
+ std::string::const_iterator, lexer_type,
+ boost::wave::iteration_context_policies::load_file_to_string,
+ collect_hooks_information<token_type> >
+ context_type;
 
     if (9 == debuglevel) {
         std::cerr << "preprocess_file: preprocessing input file: " << filename
@@ -1122,7 +1163,8 @@
 
     try {
     // create preprocessing context
- context_type ctx(instr.begin(), instr.end(), filename.c_str());
+ context_type ctx(instr.begin(), instr.end(), filename.c_str(),
+ collect_hooks_information<token_type>(hooks));
 
     // initialize the context from the options given on the command line
         if (!initialise_options(ctx, global_vm, single_line))

Modified: trunk/libs/wave/test/testwave/testwave_app.hpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave_app.hpp (original)
+++ trunk/libs/wave/test/testwave/testwave_app.hpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -59,12 +59,15 @@
     bool extract_special_information(std::string const& filename,
         std::string const& instr, char flag, std::string& content);
 
- // Extract the expected output from the given input data
+ // Extract the expected output and expected hooks information from the
+ // given input data.
     // The expected output has to be provided inside of special comments which
- // start with a capital 'R'. All such comments are concatenated and
- // returned through the parameter 'expected'.
+ // start with a capital 'R' ('H' for the hooks information). All such
+ // comments are concatenated and returned through the parameter 'expected'
+ // ('expectedhooks' for hooks information).
     bool extract_expected_output(std::string const& filename,
- std::string const& instr, std::string& expected);
+ std::string const& instr, std::string& expected,
+ std::string& expectedhooks);
         
     // Extracts the required preprocessing options from the given input data
     // and initializes the given Wave context object accordingly.
@@ -83,7 +86,8 @@
     // Preprocess the given input data and return the generated output through
     // the parameter 'result'.
     bool preprocess_file(std::string filename, std::string const& instr,
- std::string& result, std::string& error, bool single_line = false);
+ std::string& result, std::string& error, std::string& hooks,
+ bool single_line = false);
 
     // Add special predefined macros to the context object
     template <typename Context>

Modified: trunk/tools/wave/cpp.cpp
==============================================================================
--- trunk/tools/wave/cpp.cpp (original)
+++ trunk/tools/wave/cpp.cpp 2008-03-07 14:51:26 EST (Fri, 07 Mar 2008)
@@ -568,7 +568,7 @@
             
             if (ctx.get_macro_definition(*it, has_pars, predef, pos, pars, def))
             {
- macronames_out << *it;
+ macronames_out << (predef ? "-P" : "-D") << *it;
                 if (has_pars) {
                 // list the parameter names for function style macros
                     macronames_out << "(";
@@ -592,10 +592,6 @@
                     macronames_out << (*dit).get_value();
                 }
 
- // predefined macros get a 'P' appended
- if (predef)
- macronames_out << " (P)";
-
                 macronames_out << std::endl;
             }
         }


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