src/parser/String_Token_Stream.cc
string String_Token_Stream::location_() const {
  // search backwards four endlines
  unsigned begin;
  unsigned count = 0;
  for (begin = pos_; begin > 0; --begin) {
    if (text_[begin] == '\n') {
      if (++count == 4)
        break;
    }
  }
  Check(text_.size() < UINT_MAX);
  auto const end = static_cast<unsigned>(text_.size());
  unsigned i;
  for (i = begin; i < end; ++i) {
    char const c = text_[i];
    if (i >= pos_ && c == '\n') {
      break;
    }
  }
  // This kruftiness is to create the location string with a single allocation.
  string Result;
  Result.reserve(6 + i - begin);
  Result.insert(0U, "near\n", 5U);
  Result.insert(Result.end(), text_.begin() + begin, text_.begin() + i);
  Result.insert(Result.end(), 1U, '\n');
  return Result;
}
//------------------------------------------------------------------------------------------------//
/*!
 * This function constructs and returns a string of the form "near \<text\>"
 * where \<text\> reproduces the region of text where the last token was
 * parsed. This is useful for error reporting in parsers.
 *
 * \return A string of the form "near <text>"
 */
This function constructs and returns a string of the form "near \"
where \ reproduces the region of text where the last token was
parsed. This is useful for error reporting in parsers.

\return A string of the form "near "
This function constructs and returns a string of the form " near \ " where \ reproduces the region of text where the last token was parsed . This is useful for error reporting in parsers . \ return A string of the form " near "
string String_Token_Stream::location_() const {
  unsigned begin;
  unsigned count = 0;
  for (begin = pos_; begin > 0; --begin) {
    if (text_[begin] == '\n') {
      if (++count == 4)
        break;
    }
  }
  Check(text_.size() < UINT_MAX);
  auto const end = static_cast<unsigned>(text_.size());
  unsigned i;
  for (i = begin; i < end; ++i) {
    char const c = text_[i];
    if (i >= pos_ && c == '\n') {
      break;
    }
  }
  string Result;
  Result.reserve(6 + i - begin);
  Result.insert(0U, "near\n", 5U);
  Result.insert(Result.end(), text_.begin() + begin, text_.begin() + i);
  Result.insert(Result.end(), 1U, '\n');
  return Result;
}
string String_Token_Stream :: location_ ( ) const { unsigned begin ; unsigned count = 0 ; for ( begin = pos_ ; begin > 0 ; -- begin ) { if ( text_ [ begin ] == ' \n ' ) { if ( ++ count == 4 ) break ; } } Check ( text_ . size ( ) < UINT_MAX ) ; auto const end = static_cast < unsigned > ( text_ . size ( ) ) ; unsigned i ; for ( i = begin ; i < end ; ++ i ) { char const c = text_ [ i ] ; if ( i >= pos_ && c == ' \n ' ) { break ; } } string Result ; Result . reserve ( 6 + i - begin ) ; Result . insert ( 0U , " \n " , 5U ) ; Result . insert ( Result . end ( ) , text_ . begin ( ) + begin , text_ . begin ( ) + i ) ; Result . insert ( Result . end ( ) , 1U , ' \n ' ) ; return Result ; }
This function constructs and returns a string of the form "near \<text\>"
 where \<text\> reproduces the region of text where the last token was
 parsed.
This function constructs and returns a string of the form " near \ <text \ > " where \ <text \ > reproduces the region of text where the last token was parsed .
// search backwards four endlines // This kruftiness is to create the location string with a single allocation.