diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/yson/token.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yson/token.h')
-rw-r--r-- | library/cpp/yson/token.h | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/library/cpp/yson/token.h b/library/cpp/yson/token.h index 7283e569504..a0a3975eff9 100644 --- a/library/cpp/yson/token.h +++ b/library/cpp/yson/token.h @@ -5,89 +5,89 @@ #include <util/generic/strbuf.h> namespace NYson { - //////////////////////////////////////////////////////////////////////////////// - - enum ETokenType { - EndOfStream, - - String, - Int64, - Uint64, - Double, - Boolean, - - // Special values: - // YSON - Semicolon, // ; - Equals, // = - Hash, // # - LeftBracket, // [ - RightBracket, // ] - LeftBrace, // { - RightBrace, // } - LeftAngle, // < - RightAngle, // > - - // Table ranges - LeftParenthesis, // ( - RightParenthesis, // ) - Plus, // + - Colon, // : - Comma, // , - }; - - //////////////////////////////////////////////////////////////////////////////// - - ETokenType CharToTokenType(char ch); - char TokenTypeToChar(ETokenType type); - TString TokenTypeToString(ETokenType type); - - //////////////////////////////////////////////////////////////////////////////// - - class TLexerImpl; - - //////////////////////////////////////////////////////////////////////////////// - - class TToken { - public: - static const TToken EndOfStream; - - TToken(); - TToken(ETokenType type); - explicit TToken(const TStringBuf& stringValue); - explicit TToken(i64 int64Value); - explicit TToken(ui64 int64Value); - explicit TToken(double doubleValue); - explicit TToken(bool booleanValue); - - ETokenType GetType() const { - return Type_; - } - - bool IsEmpty() const; - const TStringBuf& GetStringValue() const; - i64 GetInt64Value() const; - ui64 GetUint64Value() const; - double GetDoubleValue() const; - bool GetBooleanValue() const; - - void CheckType(ETokenType expectedType) const; - void Reset(); - - private: - friend class TLexerImpl; - - ETokenType Type_; - - TStringBuf StringValue; - i64 Int64Value; - ui64 Uint64Value; - double DoubleValue; - bool BooleanValue; - }; - - TString ToString(const TToken& token); - - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + + enum ETokenType { + EndOfStream, + + String, + Int64, + Uint64, + Double, + Boolean, + + // Special values: + // YSON + Semicolon, // ; + Equals, // = + Hash, // # + LeftBracket, // [ + RightBracket, // ] + LeftBrace, // { + RightBrace, // } + LeftAngle, // < + RightAngle, // > + + // Table ranges + LeftParenthesis, // ( + RightParenthesis, // ) + Plus, // + + Colon, // : + Comma, // , + }; + + //////////////////////////////////////////////////////////////////////////////// + + ETokenType CharToTokenType(char ch); + char TokenTypeToChar(ETokenType type); + TString TokenTypeToString(ETokenType type); + + //////////////////////////////////////////////////////////////////////////////// + + class TLexerImpl; + + //////////////////////////////////////////////////////////////////////////////// + + class TToken { + public: + static const TToken EndOfStream; + + TToken(); + TToken(ETokenType type); + explicit TToken(const TStringBuf& stringValue); + explicit TToken(i64 int64Value); + explicit TToken(ui64 int64Value); + explicit TToken(double doubleValue); + explicit TToken(bool booleanValue); + + ETokenType GetType() const { + return Type_; + } + + bool IsEmpty() const; + const TStringBuf& GetStringValue() const; + i64 GetInt64Value() const; + ui64 GetUint64Value() const; + double GetDoubleValue() const; + bool GetBooleanValue() const; + + void CheckType(ETokenType expectedType) const; + void Reset(); + + private: + friend class TLexerImpl; + + ETokenType Type_; + + TStringBuf StringValue; + i64 Int64Value; + ui64 Uint64Value; + double DoubleValue; + bool BooleanValue; + }; + + TString ToString(const TToken& token); + + //////////////////////////////////////////////////////////////////////////////// } // namespace NYson |