]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Utility/StringLexer.h
MFV r276568:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Utility / StringLexer.h
1 //===--------------------- StringLexer.h -------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef utility_StringLexer_h_
11 #define utility_StringLexer_h_
12
13 #include <string>
14 #include <list>
15
16 namespace lldb_utility {
17     
18 class StringLexer
19 {
20 public:
21     typedef std::string::size_type Position;
22     typedef std::string::size_type Size;
23
24     typedef std::string::value_type Character;
25     
26     StringLexer (std::string s);
27     
28     StringLexer (const StringLexer& rhs);
29     
30     Character
31     Peek ();
32     
33     bool
34     NextIf (Character c);
35     
36     Character
37     Next ();
38     
39     bool
40     HasAtLeast (Size s);
41     
42     bool
43     HasAny (Character c);
44     
45     void
46     PutBack (Character c);
47     
48     StringLexer&
49     operator = (const StringLexer& rhs);
50     
51 private:
52     std::string m_data;
53     Position m_position;
54     std::list<Character> m_putback_data;
55     
56     void
57     Consume();
58 };
59
60 } // namespace lldb_private
61
62 #endif // #ifndef utility_StringLexer_h_