Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions samples/lexed_tokens/lexed_tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <iomanip>
#include <fstream>
#include <string>
#include <type_traits>

///////////////////////////////////////////////////////////////////////////////
// Include Wave itself
Expand Down Expand Up @@ -42,15 +43,17 @@ operator<< (std::ostream &stream,
<< left << boost::wave::get_token_name(id) << " ("
<< "#" << setw(3) << BASEID_FROM_TOKEN(id);

if (ExtTokenTypeMask & id) {
// this is an extended token id
if (AltTokenType == (id & ExtTokenOnlyMask)) {
using tokid_t = std::underlying_type<token_id>::type;
if (static_cast<tokid_t>(ExtTokenTypeMask) & static_cast<tokid_t>(id)) {
// this is an extended token id
tokid_t ext_id = static_cast<tokid_t>(id) & static_cast<tokid_t>(ExtTokenOnlyMask);
if (AltTokenType == ext_id) {
stream << ", AltTokenType";
}
else if (TriGraphTokenType == (id & ExtTokenOnlyMask)) {
else if (TriGraphTokenType == ext_id) {
stream << ", TriGraphTokenType";
}
else if (AltExtTokenType == (id & ExtTokenOnlyMask)){
else if (AltExtTokenType == ext_id) {
stream << ", AltExtTokenType";
}
}
Expand Down
14 changes: 8 additions & 6 deletions samples/real_positions/real_positions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
#include <type_traits>

///////////////////////////////////////////////////////////////////////////////
// Include Wave itself
Expand Down Expand Up @@ -48,15 +48,17 @@ operator<< (std::ostream &stream, lex_token<PositionT> const &t)
<< left << boost::wave::get_token_name(id) << " ("
<< "#" << setw(3) << BASEID_FROM_TOKEN(id);

if (ExtTokenTypeMask & id) {
// this is an extended token id
if (AltTokenType == (id & ExtTokenOnlyMask)) {
using tokid_t = std::underlying_type<token_id>::type;
if (static_cast<tokid_t>(ExtTokenTypeMask) & static_cast<tokid_t>(id)) {
// this is an extended token id
tokid_t ext_id = static_cast<tokid_t>(id) & static_cast<tokid_t>(ExtTokenOnlyMask);
if (AltTokenType == ext_id) {
stream << ", AltTokenType";
}
else if (TriGraphTokenType == (id & ExtTokenOnlyMask)) {
else if (TriGraphTokenType == ext_id) {
stream << ", TriGraphTokenType";
}
else if (AltExtTokenType == (id & ExtTokenOnlyMask)){
else if (AltExtTokenType == ext_id) {
stream << ", AltExtTokenType";
}
}
Expand Down
Loading