Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
google::protobuf::io::Tokenizer Class Reference

#include <tokenizer.h>

Classes

struct  Token
 

Public Types

enum  CommentStyle { CPP_COMMENT_STYLE, SH_COMMENT_STYLE, CPP_COMMENT_STYLE, SH_COMMENT_STYLE }
 
enum  CommentStyle { CPP_COMMENT_STYLE, SH_COMMENT_STYLE, CPP_COMMENT_STYLE, SH_COMMENT_STYLE }
 
enum  TokenType {
  TYPE_START, TYPE_END, TYPE_IDENTIFIER, TYPE_INTEGER,
  TYPE_FLOAT, TYPE_STRING, TYPE_SYMBOL, TYPE_START,
  TYPE_END, TYPE_IDENTIFIER, TYPE_INTEGER, TYPE_FLOAT,
  TYPE_STRING, TYPE_SYMBOL, TYPE_WHITESPACE, TYPE_NEWLINE
}
 
enum  TokenType {
  TYPE_START, TYPE_END, TYPE_IDENTIFIER, TYPE_INTEGER,
  TYPE_FLOAT, TYPE_STRING, TYPE_SYMBOL, TYPE_START,
  TYPE_END, TYPE_IDENTIFIER, TYPE_INTEGER, TYPE_FLOAT,
  TYPE_STRING, TYPE_SYMBOL, TYPE_WHITESPACE, TYPE_NEWLINE
}
 

Public Member Functions

const Tokencurrent ()
 
const Tokencurrent ()
 
bool Next ()
 
bool Next ()
 
bool NextWithComments (std::string *prev_trailing_comments, std::vector< std::string > *detached_comments, std::string *next_leading_comments)
 
bool NextWithComments (std::string *prev_trailing_comments, std::vector< std::string > *detached_comments, std::string *next_leading_comments)
 
const Tokenprevious ()
 
const Tokenprevious ()
 
bool report_newlines () const
 
bool report_whitespace () const
 
void set_allow_f_after_float (bool value)
 
void set_allow_f_after_float (bool value)
 
void set_allow_multiline_strings (bool allow)
 
void set_allow_multiline_strings (bool allow)
 
void set_comment_style (CommentStyle style)
 
void set_comment_style (CommentStyle style)
 
void set_report_newlines (bool report)
 
void set_report_whitespace (bool report)
 
void set_require_space_after_number (bool require)
 
void set_require_space_after_number (bool require)
 
 Tokenizer (ZeroCopyInputStream *input, ErrorCollector *error_collector)
 
 Tokenizer (ZeroCopyInputStream *input, ErrorCollector *error_collector)
 
 ~Tokenizer ()
 
 ~Tokenizer ()
 

Static Public Member Functions

static bool IsIdentifier (const std::string &text)
 
static bool IsIdentifier (const std::string &text)
 
static double ParseFloat (const std::string &text)
 
static double ParseFloat (const std::string &text)
 
static bool ParseInteger (const std::string &text, uint64 max_value, uint64 *output)
 
static bool ParseInteger (const std::string &text, uint64_t max_value, uint64_t *output)
 
static void ParseString (const std::string &text, std::string *output)
 
static void ParseString (const std::string &text, std::string *output)
 
static void ParseStringAppend (const std::string &text, std::string *output)
 
static void ParseStringAppend (const std::string &text, std::string *output)
 

Private Types

enum  NextCommentStatus {
  LINE_COMMENT, BLOCK_COMMENT, SLASH_NOT_COMMENT, NO_COMMENT,
  LINE_COMMENT, BLOCK_COMMENT, SLASH_NOT_COMMENT, NO_COMMENT
}
 
enum  NextCommentStatus {
  LINE_COMMENT, BLOCK_COMMENT, SLASH_NOT_COMMENT, NO_COMMENT,
  LINE_COMMENT, BLOCK_COMMENT, SLASH_NOT_COMMENT, NO_COMMENT
}
 

Private Member Functions

void AddError (const std::string &message)
 
void AddError (const std::string &message)
 
void ConsumeBlockComment (std::string *content)
 
void ConsumeBlockComment (std::string *content)
 
void ConsumeLineComment (std::string *content)
 
void ConsumeLineComment (std::string *content)
 
TokenType ConsumeNumber (bool started_with_zero, bool started_with_dot)
 
TokenType ConsumeNumber (bool started_with_zero, bool started_with_dot)
 
template<typename CharacterClass >
void ConsumeOneOrMore (const char *error)
 
template<typename CharacterClass >
void ConsumeOneOrMore (const char *error)
 
void ConsumeString (char delimiter)
 
void ConsumeString (char delimiter)
 
template<typename CharacterClass >
void ConsumeZeroOrMore ()
 
template<typename CharacterClass >
void ConsumeZeroOrMore ()
 
void EndToken ()
 
void EndToken ()
 
 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS (Tokenizer)
 
 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS (Tokenizer)
 
template<typename CharacterClass >
bool LookingAt ()
 
template<typename CharacterClass >
bool LookingAt ()
 
void NextChar ()
 
void NextChar ()
 
void RecordTo (std::string *target)
 
void RecordTo (std::string *target)
 
void Refresh ()
 
void Refresh ()
 
void StartToken ()
 
void StartToken ()
 
void StopRecording ()
 
void StopRecording ()
 
bool TryConsume (char c)
 
bool TryConsume (char c)
 
NextCommentStatus TryConsumeCommentStart ()
 
NextCommentStatus TryConsumeCommentStart ()
 
bool TryConsumeNewline ()
 
template<typename CharacterClass >
bool TryConsumeOne ()
 
template<typename CharacterClass >
bool TryConsumeOne ()
 
bool TryConsumeWhitespace ()
 

Private Attributes

bool allow_f_after_float_
 
bool allow_multiline_strings_
 
const char * buffer_
 
int buffer_pos_
 
int buffer_size_
 
ColumnNumber column_
 
CommentStyle comment_style_
 
Token current_
 
char current_char_
 
ErrorCollectorerror_collector_
 
ZeroCopyInputStreaminput_
 
int line_
 
Token previous_
 
bool read_error_
 
int record_start_
 
std::string * record_target_
 
bool report_newlines_ = false
 
bool report_whitespace_ = false
 
bool require_space_after_number_
 

Static Private Attributes

static const int kTabWidth = 8
 

Detailed Description

Definition at line 93 of file bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h.

Member Enumeration Documentation

◆ CommentStyle [1/2]

Enumerator
CPP_COMMENT_STYLE 
SH_COMMENT_STYLE 
CPP_COMMENT_STYLE 
SH_COMMENT_STYLE 

Definition at line 231 of file bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h.

◆ CommentStyle [2/2]

Enumerator
CPP_COMMENT_STYLE 
SH_COMMENT_STYLE 
CPP_COMMENT_STYLE 
SH_COMMENT_STYLE 

Definition at line 239 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ NextCommentStatus [1/2]

Enumerator
LINE_COMMENT 
BLOCK_COMMENT 
SLASH_NOT_COMMENT 
NO_COMMENT 
LINE_COMMENT 
BLOCK_COMMENT 
SLASH_NOT_COMMENT 
NO_COMMENT 

Definition at line 343 of file bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h.

◆ NextCommentStatus [2/2]

Enumerator
LINE_COMMENT 
BLOCK_COMMENT 
SLASH_NOT_COMMENT 
NO_COMMENT 
LINE_COMMENT 
BLOCK_COMMENT 
SLASH_NOT_COMMENT 
NO_COMMENT 

Definition at line 363 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ TokenType [1/2]

Enumerator
TYPE_START 
TYPE_END 
TYPE_IDENTIFIER 
TYPE_INTEGER 
TYPE_FLOAT 
TYPE_STRING 
TYPE_SYMBOL 
TYPE_START 
TYPE_END 
TYPE_IDENTIFIER 
TYPE_INTEGER 
TYPE_FLOAT 
TYPE_STRING 
TYPE_SYMBOL 
TYPE_WHITESPACE 
TYPE_NEWLINE 

Definition at line 101 of file bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h.

◆ TokenType [2/2]

Enumerator
TYPE_START 
TYPE_END 
TYPE_IDENTIFIER 
TYPE_INTEGER 
TYPE_FLOAT 
TYPE_STRING 
TYPE_SYMBOL 
TYPE_START 
TYPE_END 
TYPE_IDENTIFIER 
TYPE_INTEGER 
TYPE_FLOAT 
TYPE_STRING 
TYPE_SYMBOL 
TYPE_WHITESPACE 
TYPE_NEWLINE 

Definition at line 102 of file protobuf/src/google/protobuf/io/tokenizer.h.

Constructor & Destructor Documentation

◆ Tokenizer() [1/2]

google::protobuf::io::Tokenizer::Tokenizer ( ZeroCopyInputStream input,
ErrorCollector error_collector 
)

◆ ~Tokenizer() [1/2]

google::protobuf::io::Tokenizer::~Tokenizer ( )

◆ Tokenizer() [2/2]

google::protobuf::io::Tokenizer::Tokenizer ( ZeroCopyInputStream input,
ErrorCollector error_collector 
)

◆ ~Tokenizer() [2/2]

google::protobuf::io::Tokenizer::~Tokenizer ( )

Member Function Documentation

◆ AddError() [1/2]

void google::protobuf::io::Tokenizer::AddError ( const std::string &  message)
inlineprivate

◆ AddError() [2/2]

void google::protobuf::io::Tokenizer::AddError ( const std::string &  message)
inlineprivate

Definition at line 336 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ ConsumeBlockComment() [1/2]

void google::protobuf::io::Tokenizer::ConsumeBlockComment ( std::string *  content)
private

◆ ConsumeBlockComment() [2/2]

void google::protobuf::io::Tokenizer::ConsumeBlockComment ( std::string *  content)
private

◆ ConsumeLineComment() [1/2]

void google::protobuf::io::Tokenizer::ConsumeLineComment ( std::string *  content)
private

◆ ConsumeLineComment() [2/2]

void google::protobuf::io::Tokenizer::ConsumeLineComment ( std::string *  content)
private

◆ ConsumeNumber() [1/2]

Tokenizer::TokenType google::protobuf::io::Tokenizer::ConsumeNumber ( bool  started_with_zero,
bool  started_with_dot 
)
private

◆ ConsumeNumber() [2/2]

TokenType google::protobuf::io::Tokenizer::ConsumeNumber ( bool  started_with_zero,
bool  started_with_dot 
)
private

◆ ConsumeOneOrMore() [1/2]

template<typename CharacterClass >
void google::protobuf::io::Tokenizer::ConsumeOneOrMore ( const char *  error)
inlineprivate

◆ ConsumeOneOrMore() [2/2]

template<typename CharacterClass >
void google::protobuf::io::Tokenizer::ConsumeOneOrMore ( const char *  error)
inlineprivate

◆ ConsumeString() [1/2]

void google::protobuf::io::Tokenizer::ConsumeString ( char  delimiter)
private

◆ ConsumeString() [2/2]

void google::protobuf::io::Tokenizer::ConsumeString ( char  delimiter)
private

◆ ConsumeZeroOrMore() [1/2]

template<typename CharacterClass >
void google::protobuf::io::Tokenizer::ConsumeZeroOrMore
inlineprivate

◆ ConsumeZeroOrMore() [2/2]

template<typename CharacterClass >
void google::protobuf::io::Tokenizer::ConsumeZeroOrMore ( )
inlineprivate

◆ current() [1/2]

const Tokenizer::Token & google::protobuf::io::Tokenizer::current ( )
inline

◆ current() [2/2]

const Token& google::protobuf::io::Tokenizer::current ( )

◆ EndToken() [1/2]

void google::protobuf::io::Tokenizer::EndToken ( )
inlineprivate

◆ EndToken() [2/2]

void google::protobuf::io::Tokenizer::EndToken ( )
inlineprivate

◆ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS() [1/2]

google::protobuf::io::Tokenizer::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS ( Tokenizer  )
private

◆ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS() [2/2]

google::protobuf::io::Tokenizer::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS ( Tokenizer  )
private

◆ IsIdentifier() [1/2]

bool google::protobuf::io::Tokenizer::IsIdentifier ( const std::string &  text)
static

◆ IsIdentifier() [2/2]

static bool google::protobuf::io::Tokenizer::IsIdentifier ( const std::string &  text)
static

◆ LookingAt() [1/2]

template<typename CharacterClass >
bool google::protobuf::io::Tokenizer::LookingAt
inlineprivate

◆ LookingAt() [2/2]

template<typename CharacterClass >
bool google::protobuf::io::Tokenizer::LookingAt ( )
inlineprivate

◆ Next() [1/2]

bool google::protobuf::io::Tokenizer::Next ( )

◆ Next() [2/2]

bool google::protobuf::io::Tokenizer::Next ( )

◆ NextChar() [1/2]

void google::protobuf::io::Tokenizer::NextChar ( )
private

◆ NextChar() [2/2]

void google::protobuf::io::Tokenizer::NextChar ( )
private

◆ NextWithComments() [1/2]

bool google::protobuf::io::Tokenizer::NextWithComments ( std::string *  prev_trailing_comments,
std::vector< std::string > *  detached_comments,
std::string *  next_leading_comments 
)

◆ NextWithComments() [2/2]

bool google::protobuf::io::Tokenizer::NextWithComments ( std::string *  prev_trailing_comments,
std::vector< std::string > *  detached_comments,
std::string *  next_leading_comments 
)

◆ ParseFloat() [1/2]

double google::protobuf::io::Tokenizer::ParseFloat ( const std::string &  text)
static

◆ ParseFloat() [2/2]

static double google::protobuf::io::Tokenizer::ParseFloat ( const std::string &  text)
static

◆ ParseInteger() [1/2]

bool google::protobuf::io::Tokenizer::ParseInteger ( const std::string &  text,
uint64  max_value,
uint64 output 
)
static

◆ ParseInteger() [2/2]

static bool google::protobuf::io::Tokenizer::ParseInteger ( const std::string &  text,
uint64_t  max_value,
uint64_t output 
)
static

◆ ParseString() [1/2]

void google::protobuf::io::Tokenizer::ParseString ( const std::string &  text,
std::string *  output 
)
inlinestatic

◆ ParseString() [2/2]

static void google::protobuf::io::Tokenizer::ParseString ( const std::string &  text,
std::string *  output 
)
static

◆ ParseStringAppend() [1/2]

void google::protobuf::io::Tokenizer::ParseStringAppend ( const std::string &  text,
std::string *  output 
)
static

◆ ParseStringAppend() [2/2]

static void google::protobuf::io::Tokenizer::ParseStringAppend ( const std::string &  text,
std::string *  output 
)
static

◆ previous() [1/2]

const Tokenizer::Token & google::protobuf::io::Tokenizer::previous ( )
inline

◆ previous() [2/2]

const Token& google::protobuf::io::Tokenizer::previous ( )

◆ RecordTo() [1/2]

void google::protobuf::io::Tokenizer::RecordTo ( std::string *  target)
inlineprivate

◆ RecordTo() [2/2]

void google::protobuf::io::Tokenizer::RecordTo ( std::string *  target)
inlineprivate

◆ Refresh() [1/2]

void google::protobuf::io::Tokenizer::Refresh ( )
private

◆ Refresh() [2/2]

void google::protobuf::io::Tokenizer::Refresh ( )
private

◆ report_newlines()

bool google::protobuf::io::Tokenizer::report_newlines ( ) const

◆ report_whitespace()

bool google::protobuf::io::Tokenizer::report_whitespace ( ) const

◆ set_allow_f_after_float() [1/2]

void google::protobuf::io::Tokenizer::set_allow_f_after_float ( bool  value)
inline

◆ set_allow_f_after_float() [2/2]

void google::protobuf::io::Tokenizer::set_allow_f_after_float ( bool  value)
inline

Definition at line 236 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ set_allow_multiline_strings() [1/2]

void google::protobuf::io::Tokenizer::set_allow_multiline_strings ( bool  allow)
inline

◆ set_allow_multiline_strings() [2/2]

void google::protobuf::io::Tokenizer::set_allow_multiline_strings ( bool  allow)
inline

Definition at line 258 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ set_comment_style() [1/2]

void google::protobuf::io::Tokenizer::set_comment_style ( CommentStyle  style)
inline

◆ set_comment_style() [2/2]

void google::protobuf::io::Tokenizer::set_comment_style ( CommentStyle  style)
inline

Definition at line 248 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ set_report_newlines()

void google::protobuf::io::Tokenizer::set_report_newlines ( bool  report)

◆ set_report_whitespace()

void google::protobuf::io::Tokenizer::set_report_whitespace ( bool  report)

◆ set_require_space_after_number() [1/2]

void google::protobuf::io::Tokenizer::set_require_space_after_number ( bool  require)
inline

◆ set_require_space_after_number() [2/2]

void google::protobuf::io::Tokenizer::set_require_space_after_number ( bool  require)
inline

Definition at line 252 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ StartToken() [1/2]

void google::protobuf::io::Tokenizer::StartToken ( )
inlineprivate

◆ StartToken() [2/2]

void google::protobuf::io::Tokenizer::StartToken ( )
inlineprivate

◆ StopRecording() [1/2]

void google::protobuf::io::Tokenizer::StopRecording ( )
inlineprivate

◆ StopRecording() [2/2]

void google::protobuf::io::Tokenizer::StopRecording ( )
inlineprivate

◆ TryConsume() [1/2]

bool google::protobuf::io::Tokenizer::TryConsume ( char  c)
inlineprivate

◆ TryConsume() [2/2]

bool google::protobuf::io::Tokenizer::TryConsume ( char  c)
inlineprivate

◆ TryConsumeCommentStart() [1/2]

Tokenizer::NextCommentStatus google::protobuf::io::Tokenizer::TryConsumeCommentStart ( )
private

◆ TryConsumeCommentStart() [2/2]

NextCommentStatus google::protobuf::io::Tokenizer::TryConsumeCommentStart ( )
private

◆ TryConsumeNewline()

bool google::protobuf::io::Tokenizer::TryConsumeNewline ( )
private

◆ TryConsumeOne() [1/2]

template<typename CharacterClass >
bool google::protobuf::io::Tokenizer::TryConsumeOne
inlineprivate

◆ TryConsumeOne() [2/2]

template<typename CharacterClass >
bool google::protobuf::io::Tokenizer::TryConsumeOne ( )
inlineprivate

◆ TryConsumeWhitespace()

bool google::protobuf::io::Tokenizer::TryConsumeWhitespace ( )
private

Member Data Documentation

◆ allow_f_after_float_

bool google::protobuf::io::Tokenizer::allow_f_after_float_
private

◆ allow_multiline_strings_

bool google::protobuf::io::Tokenizer::allow_multiline_strings_
private

◆ buffer_

const char * google::protobuf::io::Tokenizer::buffer_
private

◆ buffer_pos_

int google::protobuf::io::Tokenizer::buffer_pos_
private

◆ buffer_size_

int google::protobuf::io::Tokenizer::buffer_size_
private

◆ column_

ColumnNumber google::protobuf::io::Tokenizer::column_
private

◆ comment_style_

CommentStyle google::protobuf::io::Tokenizer::comment_style_
private

◆ current_

Token google::protobuf::io::Tokenizer::current_
private

◆ current_char_

char google::protobuf::io::Tokenizer::current_char_
private

◆ error_collector_

ErrorCollector * google::protobuf::io::Tokenizer::error_collector_
private

◆ input_

ZeroCopyInputStream * google::protobuf::io::Tokenizer::input_
private

◆ kTabWidth

static const int google::protobuf::io::Tokenizer::kTabWidth = 8
staticprivate

◆ line_

int google::protobuf::io::Tokenizer::line_
private

◆ previous_

Token google::protobuf::io::Tokenizer::previous_
private

◆ read_error_

bool google::protobuf::io::Tokenizer::read_error_
private

◆ record_start_

int google::protobuf::io::Tokenizer::record_start_
private

◆ record_target_

std::string * google::protobuf::io::Tokenizer::record_target_
private

◆ report_newlines_

bool google::protobuf::io::Tokenizer::report_newlines_ = false
private

Definition at line 308 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ report_whitespace_

bool google::protobuf::io::Tokenizer::report_whitespace_ = false
private

Definition at line 307 of file protobuf/src/google/protobuf/io/tokenizer.h.

◆ require_space_after_number_

bool google::protobuf::io::Tokenizer::require_space_after_number_
private

The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:28