update boost on linux
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
http://www.boost.org/
|
||||
|
||||
State machine detecting include guards in an included file.
|
||||
State machine detecting include guards in an included file.
|
||||
This detects two forms of include guards:
|
||||
|
||||
#ifndef INCLUDE_GUARD_MACRO
|
||||
@@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO
|
||||
will work as well). The code allows for any whitespace, newline and single
|
||||
will work as well). The code allows for any whitespace, newline and single
|
||||
'#' tokens before the #if/#ifndef and after the final #endif.
|
||||
|
||||
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
|
||||
@@ -47,19 +47,19 @@ class include_guards
|
||||
{
|
||||
public:
|
||||
include_guards()
|
||||
: state(&include_guards::state_0), detected_guards(false),
|
||||
: state(&include_guards::state_0), detected_guards(false),
|
||||
current_state(true), if_depth(0)
|
||||
{}
|
||||
|
||||
Token& detect_guard(Token& t)
|
||||
Token& detect_guard(Token& t)
|
||||
{ return current_state ? (this->*state)(t) : t; }
|
||||
bool detected(std::string& guard_name_) const
|
||||
bool detected(std::string& guard_name_) const
|
||||
{
|
||||
if (detected_guards) {
|
||||
guard_name_ = guard_name.c_str();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
|
||||
bool is_skippable(token_id id) const
|
||||
{
|
||||
return (T_POUND == BASE_TOKEN(id) ||
|
||||
return (T_POUND == BASE_TOKEN(id) ||
|
||||
IS_CATEGORY(id, WhiteSpaceTokenType) ||
|
||||
IS_CATEGORY(id, EOLTokenType));
|
||||
}
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 0: beginning of a file, tries to recognize #ifndef or #if tokens
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_0(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
@@ -101,7 +101,7 @@ include_guards<Token>::state_0(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 1: found #ifndef, looking for T_IDENTIFIER
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_1(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
@@ -117,11 +117,11 @@ include_guards<Token>::state_1(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 1a: found T_PP_IF, looking for T_NOT ("!")
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_1a(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
if (T_NOT == BASE_TOKEN(id))
|
||||
if (T_NOT == BASE_TOKEN(id))
|
||||
state = &include_guards::state_1b;
|
||||
else if (!is_skippable(id))
|
||||
current_state = false;
|
||||
@@ -131,11 +131,11 @@ include_guards<Token>::state_1a(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 1b: found T_NOT, looking for 'defined'
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_1b(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
if (T_IDENTIFIER == id && t.get_value() == "defined")
|
||||
if (T_IDENTIFIER == id && t.get_value() == "defined")
|
||||
state = &include_guards::state_1c;
|
||||
else if (!is_skippable(id))
|
||||
current_state = false;
|
||||
@@ -145,11 +145,11 @@ include_guards<Token>::state_1b(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 1c: found 'defined', looking for (optional) T_LEFTPAREN
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_1c(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
if (T_LEFTPAREN == id)
|
||||
if (T_LEFTPAREN == id)
|
||||
state = &include_guards::state_1d;
|
||||
else if (T_IDENTIFIER == id) {
|
||||
guard_name = t.get_value();
|
||||
@@ -163,7 +163,7 @@ include_guards<Token>::state_1c(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 1d: found T_LEFTPAREN, looking for T_IDENTIFIER guard
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_1d(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
@@ -179,11 +179,11 @@ include_guards<Token>::state_1d(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 1e: found T_IDENTIFIER guard, looking for T_RIGHTPAREN
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_1e(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
if (T_RIGHTPAREN == id)
|
||||
if (T_RIGHTPAREN == id)
|
||||
state = &include_guards::state_2;
|
||||
else if (!is_skippable(id))
|
||||
current_state = false;
|
||||
@@ -193,11 +193,11 @@ include_guards<Token>::state_1e(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 2: found T_IDENTIFIER, looking for #define
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_2(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
if (T_PP_DEFINE == id)
|
||||
if (T_PP_DEFINE == id)
|
||||
state = &include_guards::state_3;
|
||||
else if (!is_skippable(id))
|
||||
current_state = false;
|
||||
@@ -207,7 +207,7 @@ include_guards<Token>::state_2(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 3: found #define, looking for T_IDENTIFIER as recognized by state 1
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_3(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
@@ -221,7 +221,7 @@ include_guards<Token>::state_3(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 4: found guard T_IDENTIFIER, looking for #endif
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_4(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
@@ -239,11 +239,11 @@ include_guards<Token>::state_4(Token& t)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// state 5: found final #endif, looking for T_EOF
|
||||
template <typename Token>
|
||||
inline Token&
|
||||
inline Token&
|
||||
include_guards<Token>::state_5(Token& t)
|
||||
{
|
||||
token_id id = token_id(t);
|
||||
if (T_EOF == id)
|
||||
if (T_EOF == id)
|
||||
detected_guards = current_state;
|
||||
else if (!is_skippable(id))
|
||||
current_state = false;
|
||||
|
||||
Reference in New Issue
Block a user