[clang-tidy] convert member functions to static
Found with readability-convert-member-functions-to-static Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
1863090b55
commit
ab05c7c338
@ -126,7 +126,6 @@ class YAML_CPP_API Emitter {
|
|||||||
|
|
||||||
const char* ComputeFullBoolName(bool b) const;
|
const char* ComputeFullBoolName(bool b) const;
|
||||||
const char* ComputeNullName() const;
|
const char* ComputeNullName() const;
|
||||||
bool CanEmitNewline() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<EmitterState> m_pState;
|
std::unique_ptr<EmitterState> m_pState;
|
||||||
|
|||||||
@ -269,8 +269,6 @@ void Emitter::EmitNewline() {
|
|||||||
m_pState->SetNonContent();
|
m_pState->SetNonContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Emitter::CanEmitNewline() const { return true; }
|
|
||||||
|
|
||||||
// Put the stream in a state so we can simply write the next node
|
// Put the stream in a state so we can simply write the next node
|
||||||
// E.g., if we're in a sequence, write the "- "
|
// E.g., if we're in a sequence, write the "- "
|
||||||
void Emitter::PrepareNode(EmitterNodeType::value child) {
|
void Emitter::PrepareNode(EmitterNodeType::value child) {
|
||||||
|
|||||||
@ -7,6 +7,19 @@
|
|||||||
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
|
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
|
||||||
|
|
||||||
namespace YAML {
|
namespace YAML {
|
||||||
|
namespace {
|
||||||
|
// IsWhitespaceToBeEaten
|
||||||
|
// . We can eat whitespace if it's a space or tab
|
||||||
|
// . Note: originally tabs in block context couldn't be eaten
|
||||||
|
// "where a simple key could be allowed
|
||||||
|
// (i.e., not at the beginning of a line, or following '-', '?', or
|
||||||
|
// ':')"
|
||||||
|
// I think this is wrong, since tabs can be non-content whitespace; it's just
|
||||||
|
// that they can't contribute to indentation, so once you've seen a tab in a
|
||||||
|
// line, you can't start a simple key
|
||||||
|
bool IsWhitespaceToBeEaten(char ch) { return (ch == ' ') || (ch == '\t'); }
|
||||||
|
} // namespace
|
||||||
|
|
||||||
Scanner::Scanner(std::istream& in)
|
Scanner::Scanner(std::istream& in)
|
||||||
: INPUT(in),
|
: INPUT(in),
|
||||||
m_tokens{},
|
m_tokens{},
|
||||||
@ -213,27 +226,6 @@ void Scanner::ScanToNextToken() {
|
|||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
// Misc. helpers
|
// Misc. helpers
|
||||||
|
|
||||||
// IsWhitespaceToBeEaten
|
|
||||||
// . We can eat whitespace if it's a space or tab
|
|
||||||
// . Note: originally tabs in block context couldn't be eaten
|
|
||||||
// "where a simple key could be allowed
|
|
||||||
// (i.e., not at the beginning of a line, or following '-', '?', or
|
|
||||||
// ':')"
|
|
||||||
// I think this is wrong, since tabs can be non-content whitespace; it's just
|
|
||||||
// that they can't contribute to indentation, so once you've seen a tab in a
|
|
||||||
// line, you can't start a simple key
|
|
||||||
bool Scanner::IsWhitespaceToBeEaten(char ch) {
|
|
||||||
if (ch == ' ') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch == '\t') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RegEx& Scanner::GetValueRegex() const {
|
const RegEx& Scanner::GetValueRegex() const {
|
||||||
if (InBlockContext()) {
|
if (InBlockContext()) {
|
||||||
return Exp::Value();
|
return Exp::Value();
|
||||||
@ -269,7 +261,7 @@ Token* Scanner::PushToken(Token::TYPE type) {
|
|||||||
return &m_tokens.back();
|
return &m_tokens.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const {
|
Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IndentMarker::SEQ:
|
case IndentMarker::SEQ:
|
||||||
return Token::BLOCK_SEQ_START;
|
return Token::BLOCK_SEQ_START;
|
||||||
|
|||||||
@ -90,7 +90,7 @@ class Scanner {
|
|||||||
bool InBlockContext() const { return m_flows.empty(); }
|
bool InBlockContext() const { return m_flows.empty(); }
|
||||||
std::size_t GetFlowLevel() const { return m_flows.size(); }
|
std::size_t GetFlowLevel() const { return m_flows.size(); }
|
||||||
|
|
||||||
Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const;
|
static Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes an indentation onto the stack, and enqueues the proper token
|
* Pushes an indentation onto the stack, and enqueues the proper token
|
||||||
@ -131,8 +131,6 @@ class Scanner {
|
|||||||
*/
|
*/
|
||||||
void ThrowParserException(const std::string &msg) const;
|
void ThrowParserException(const std::string &msg) const;
|
||||||
|
|
||||||
bool IsWhitespaceToBeEaten(char ch);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the appropriate regex to check if the next token is a value token.
|
* Returns the appropriate regex to check if the next token is a value token.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user