summaryrefslogtreecommitdiff
path: root/boost/wave/cpplexer/re2clex
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
committerChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
commit08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch)
tree7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/wave/cpplexer/re2clex
parentbb4dd8289b351fae6b55e303f189127a394a1edd (diff)
downloadboost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/wave/cpplexer/re2clex')
-rw-r--r--boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp96
-rw-r--r--boost/wave/cpplexer/re2clex/scanner.hpp16
2 files changed, 56 insertions, 56 deletions
diff --git a/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp b/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp
index d22a0154ae..0d3e0257dc 100644
--- a/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp
+++ b/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp
@@ -54,21 +54,21 @@ namespace cpplexer {
namespace re2clex {
///////////////////////////////////////////////////////////////////////////////
-//
+//
// encapsulation of the re2c based cpp lexer
//
///////////////////////////////////////////////////////////////////////////////
-template <typename IteratorT,
+template <typename IteratorT,
typename PositionT = boost::wave::util::file_position_type,
typename TokenT = lex_token<PositionT> >
-class lexer
+class lexer
{
public:
typedef TokenT token_type;
typedef typename token_type::string_type string_type;
- lexer(IteratorT const &first, IteratorT const &last,
+ lexer(IteratorT const &first, IteratorT const &last,
PositionT const &pos, boost::wave::language_support language_);
~lexer();
@@ -82,9 +82,9 @@ public:
scanner.file_name = filename.c_str();
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- bool has_include_guards(std::string& guard_name) const
- {
- return guards.detected(guard_name);
+ bool has_include_guards(std::string& guard_name) const
+ {
+ return guards.detected(guard_name);
}
#endif
@@ -111,12 +111,12 @@ private:
};
///////////////////////////////////////////////////////////////////////////////
-// initialize cpp lexer
+// initialize cpp lexer
template <typename IteratorT, typename PositionT, typename TokenT>
inline
-lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
- IteratorT const &last, PositionT const &pos,
- boost::wave::language_support language_)
+lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
+ IteratorT const &last, PositionT const &pos,
+ boost::wave::language_support language_)
: filename(pos.get_file()), at_eof(false), language(language_)
#if BOOST_WAVE_SUPPORT_THREADING != 0
, cache()
@@ -127,7 +127,7 @@ lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
scanner.eol_offsets = aq_create();
if (first != last) {
scanner.first = scanner.act = (uchar *)&(*first);
- scanner.last = scanner.first + std::distance(first, last);
+ scanner.last = scanner.first + std::distance(first, last);
}
scanner.line = pos.get_line();
scanner.column = scanner.curr_column = pos.get_column();
@@ -162,7 +162,7 @@ lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
template <typename IteratorT, typename PositionT, typename TokenT>
inline
-lexer<IteratorT, PositionT, TokenT>::~lexer()
+lexer<IteratorT, PositionT, TokenT>::~lexer()
{
using namespace std; // some systems have free in std
aq_terminate(scanner.eol_offsets);
@@ -175,31 +175,31 @@ template <typename IteratorT, typename PositionT, typename TokenT>
inline TokenT&
lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
{
- if (at_eof)
+ if (at_eof)
return result = token_type(); // return T_EOI
- unsigned int actline = scanner.line;
+ std::size_t actline = scanner.line;
token_id id = token_id(scan(&scanner));
switch (static_cast<unsigned int>(id)) {
case T_IDENTIFIER:
// test identifier characters for validity (throws if invalid chars found)
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
if (!boost::wave::need_no_character_validation(language))
- impl::validate_identifier_name(value, actline, scanner.column, filename);
+ impl::validate_identifier_name(value, actline, scanner.column, filename);
break;
case T_STRINGLIT:
case T_CHARLIT:
case T_RAWSTRINGLIT:
// test literal characters for validity (throws if invalid chars found)
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
if (boost::wave::need_convert_trigraphs(language))
- value = impl::convert_trigraphs(value);
+ value = impl::convert_trigraphs(value);
if (!boost::wave::need_no_character_validation(language))
- impl::validate_literal(value, actline, scanner.column, filename);
+ impl::validate_literal(value, actline, scanner.column, filename);
break;
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
@@ -208,7 +208,7 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
case T_PP_INCLUDE:
// convert to the corresponding ..._next token, if appropriate
{
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
// Skip '#' and whitespace and see whether we find an 'include_next' here.
@@ -220,11 +220,11 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
#endif
case T_LONGINTLIT: // supported in C++11, C99 and long_long mode
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
if (!boost::wave::need_long_long(language)) {
// syntax error: not allowed in C++ mode
- BOOST_WAVE_LEXER_THROW(lexing_exception, invalid_long_long_literal,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, invalid_long_long_literal,
value.c_str(), actline, scanner.column, filename.c_str());
}
break;
@@ -241,7 +241,7 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
case T_SPACE2:
case T_ANY:
case T_PP_NUMBER:
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
break;
@@ -264,7 +264,7 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
value = cache.get_token_value(BASEID_FROM_TOKEN(id));
}
else {
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
}
break;
@@ -272,10 +272,10 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
case T_ANY_TRIGRAPH:
if (boost::wave::need_convert_trigraphs(language)) {
value = impl::convert_trigraph(
- string_type((char const *)scanner.tok));
+ string_type((char const *)scanner.tok));
}
else {
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
}
break;
@@ -284,7 +284,7 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
if (CATEGORY_FROM_TOKEN(id) != EXTCATEGORY_FROM_TOKEN(id) ||
IS_CATEGORY(id, UnknownTokenType))
{
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
}
else {
@@ -306,8 +306,8 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
}
template <typename IteratorT, typename PositionT, typename TokenT>
-inline int
-lexer<IteratorT, PositionT, TokenT>::report_error(Scanner const *s, int errcode,
+inline int
+lexer<IteratorT, PositionT, TokenT>::report_error(Scanner const *s, int errcode,
char const *msg, ...)
{
BOOST_ASSERT(0 != s);
@@ -321,28 +321,28 @@ lexer<IteratorT, PositionT, TokenT>::report_error(Scanner const *s, int errcode,
vsprintf(buffer, msg, params);
va_end(params);
- BOOST_WAVE_LEXER_THROW_VAR(lexing_exception, errcode, buffer, s->line,
+ BOOST_WAVE_LEXER_THROW_VAR(lexing_exception, errcode, buffer, s->line,
s->column, s->file_name);
// BOOST_UNREACHABLE_RETURN(0);
return 0;
}
///////////////////////////////////////////////////////////////////////////////
-//
+//
// lex_functor
-//
+//
///////////////////////////////////////////////////////////////////////////////
-template <typename IteratorT,
+template <typename IteratorT,
typename PositionT = boost::wave::util::file_position_type,
typename TokenT = typename lexer<IteratorT, PositionT>::token_type>
-class lex_functor
+class lex_functor
: public lex_input_interface_generator<TokenT>
{
public:
typedef TokenT token_type;
- lex_functor(IteratorT const &first, IteratorT const &last,
+ lex_functor(IteratorT const &first, IteratorT const &last,
PositionT const &pos, boost::wave::language_support language)
: re2c_lexer(first, last, pos, language)
{}
@@ -352,7 +352,7 @@ public:
token_type& get(token_type& result) { return re2c_lexer.get(result); }
void set_position(PositionT const &pos) { re2c_lexer.set_position(pos); }
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- bool has_include_guards(std::string& guard_name) const
+ bool has_include_guards(std::string& guard_name) const
{ return re2c_lexer.has_include_guards(guard_name); }
#endif
@@ -364,16 +364,16 @@ private:
///////////////////////////////////////////////////////////////////////////////
template <typename IteratorT, typename PositionT, typename TokenT>
token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type> const
- lexer<IteratorT, PositionT, TokenT>::cache =
+ lexer<IteratorT, PositionT, TokenT>::cache =
token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type>();
#endif
} // namespace re2clex
///////////////////////////////////////////////////////////////////////////////
-//
+//
// The new_lexer_gen<>::new_lexer function (declared in cpp_lex_interface.hpp)
-// should be defined inline, if the lex_functor shouldn't be instantiated
+// should be defined inline, if the lex_functor shouldn't be instantiated
// separately from the lex_iterator.
//
// Separate (explicit) instantiation helps to reduce compilation time.
@@ -384,21 +384,21 @@ token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type> const
#define BOOST_WAVE_RE2C_NEW_LEXER_INLINE
#else
#define BOOST_WAVE_RE2C_NEW_LEXER_INLINE inline
-#endif
+#endif
///////////////////////////////////////////////////////////////////////////////
//
// The 'new_lexer' function allows the opaque generation of a new lexer object.
-// It is coupled to the iterator type to allow to decouple the lexer/iterator
+// It is coupled to the iterator type to allow to decouple the lexer/iterator
// configurations at compile time.
//
-// This function is declared inside the cpp_lex_token.hpp file, which is
+// This function is declared inside the cpp_lex_token.hpp file, which is
// referenced by the source file calling the lexer and the source file, which
-// instantiates the lex_functor. But is is defined here, so it will be
-// instantiated only while compiling the source file, which instantiates the
+// instantiates the lex_functor. But it is defined here, so it will be
+// instantiated only while compiling the source file, which instantiates the
// lex_functor. While the cpp_re2c_token.hpp file may be included everywhere,
// this file (cpp_re2c_lexer.hpp) should be included only once. This allows
-// to decouple the lexer interface from the lexer implementation and reduces
+// to decouple the lexer interface from the lexer implementation and reduces
// compilation time.
//
///////////////////////////////////////////////////////////////////////////////
@@ -407,7 +407,7 @@ template <typename IteratorT, typename PositionT, typename TokenT>
BOOST_WAVE_RE2C_NEW_LEXER_INLINE
lex_input_interface<TokenT> *
new_lexer_gen<IteratorT, PositionT, TokenT>::new_lexer(IteratorT const &first,
- IteratorT const &last, PositionT const &pos,
+ IteratorT const &last, PositionT const &pos,
boost::wave::language_support language)
{
using re2clex::lex_functor;
@@ -419,7 +419,7 @@ new_lexer_gen<IteratorT, PositionT, TokenT>::new_lexer(IteratorT const &first,
///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace wave
-} // namespace boost
+} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS
diff --git a/boost/wave/cpplexer/re2clex/scanner.hpp b/boost/wave/cpplexer/re2clex/scanner.hpp
index 1c696cf69b..a2c36f99b6 100644
--- a/boost/wave/cpplexer/re2clex/scanner.hpp
+++ b/boost/wave/cpplexer/re2clex/scanner.hpp
@@ -4,8 +4,8 @@
http://www.boost.org/
Copyright (c) 2001 Daniel C. Nuffer.
- Copyright (c) 2001-2012 Hartmut Kaiser.
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ Copyright (c) 2001-2012 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)
=============================================================================*/
@@ -28,7 +28,7 @@ namespace re2clex {
struct Scanner;
typedef unsigned char uchar;
-typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
+typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
char const *, ...);
typedef struct Scanner {
@@ -37,7 +37,7 @@ typedef struct Scanner {
uchar* last; /* end (one past last char) of input buffer */
uchar* bot; /* beginning of the current buffer */
uchar* top; /* top of the current buffer */
- uchar* eof; /* when we read in the last buffer, will point 1 past the
+ uchar* eof; /* when we read in the last buffer, will point 1 past the
end of the file, otherwise 0 */
uchar* tok; /* points to the beginning of the current token */
uchar* ptr; /* used for YYMARKER - saves backtracking info */
@@ -45,10 +45,10 @@ typedef struct Scanner {
uchar* lim; /* used for YYLIMIT - points to the end of the buffer */
/* (lim == top) except for the last buffer, it points to
the end of the input (lim == eof - 1) */
- unsigned int line; /* current line being lex'ed */
- unsigned int column; /* current token start column position */
- unsigned int curr_column; /* current column position */
- ReportErrorProc error_proc; /* must be != 0, this function is called to
+ std::size_t line; /* current line being lex'ed */
+ std::size_t column; /* current token start column position */
+ std::size_t curr_column; /* current column position */
+ ReportErrorProc error_proc; /* must be != 0, this function is called to
report an error */
char const *file_name; /* name of the lex'ed file */
aq_queue eol_offsets;