diff options
Diffstat (limited to 'lldb/include/lldb/Utility/StringLexer.h')
-rw-r--r-- | lldb/include/lldb/Utility/StringLexer.h | 89 |
1 files changed, 39 insertions, 50 deletions
diff --git a/lldb/include/lldb/Utility/StringLexer.h b/lldb/include/lldb/Utility/StringLexer.h index ae6b393..3a399df 100644 --- a/lldb/include/lldb/Utility/StringLexer.h +++ b/lldb/include/lldb/Utility/StringLexer.h @@ -1,4 +1,5 @@ -//===--------------------- StringLexer.h -------------------------*- C++ -*-===// +//===--------------------- StringLexer.h -------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -15,57 +16,45 @@ #include <string> namespace lldb_utility { - -class StringLexer -{ + +class StringLexer { public: - typedef std::string::size_type Position; - typedef std::string::size_type Size; - - typedef std::string::value_type Character; - - StringLexer (std::string s); - - StringLexer (const StringLexer& rhs); - - // These APIs are not bounds-checked. Use HasAtLeast() if you're not sure. - Character - Peek (); - - bool - NextIf (Character c); - - std::pair<bool, Character> - NextIf (std::initializer_list<Character> cs); - - bool - AdvanceIf (const std::string& token); - - Character - Next (); - - bool - HasAtLeast (Size s); - - bool - HasAny (Character c); - - std::string - GetUnlexed (); - - // This will assert if there are less than s characters preceding the cursor. - void - PutBack (Size s); - - StringLexer& - operator = (const StringLexer& rhs); - + typedef std::string::size_type Position; + typedef std::string::size_type Size; + + typedef std::string::value_type Character; + + StringLexer(std::string s); + + StringLexer(const StringLexer &rhs); + + // These APIs are not bounds-checked. Use HasAtLeast() if you're not sure. + Character Peek(); + + bool NextIf(Character c); + + std::pair<bool, Character> NextIf(std::initializer_list<Character> cs); + + bool AdvanceIf(const std::string &token); + + Character Next(); + + bool HasAtLeast(Size s); + + bool HasAny(Character c); + + std::string GetUnlexed(); + + // This will assert if there are less than s characters preceding the cursor. + void PutBack(Size s); + + StringLexer &operator=(const StringLexer &rhs); + private: - std::string m_data; - Position m_position; - - void - Consume(); + std::string m_data; + Position m_position; + + void Consume(); }; } // namespace lldb_private |