Debian Codegraph @

CodeLite/CxxTokenizer.h

raw
1 #ifndef CXXTOKENIZER_H
2 #define CXXTOKENIZER_H
3
4 #include "CxxLexerAPI.h"
5
6 class WXDLLIMPEXP_CL CxxTokenizer
7 {
8 Scanner_t m_scanner;
9 wxString m_buffer;
10 CxxLexerToken m_lastToken;
11
12 protected:
13 CppLexerUserData* GetUserData() const;
14
15 public:
16 CxxTokenizer();
17 virtual ~CxxTokenizer();
18
19 /**
20 * @brief get the next token from the toknizer
21 * @reutrn false when reached EOF
22 */
23 bool NextToken(CxxLexerToken& token);
24
25 /**
26 * @brief return the last token back to the scanner
27 */
28 bool UngetToken();
29
30 /**
31 * @brief reset the lexer with a new text buffer
32 */
33 void Reset(const wxString& buffer);
34
35 /**
36 * @brief read until 'delim' is found. Return true if 'delim' found
37 * also, return the data read
38 */
39 bool ReadUntilClosingBracket(int delim, wxString& bufferRead);
40
41 const CxxLexerToken& GetLastToken() const { return m_lastToken; }
42 /**
43 * @brief peek at the next token and return its type
44 */
45 int PeekToken(wxString& text);
46
47 /**
48 * @brief given an input string, return the visible scope at the end of the buffer
49 * e.g.
50 *
51 * Input string:
52 *
53 * void foo() {
54 * int a;
55 * int b;
56 * }
57 *
58 * void bar() {
59 * |
60 *
61 * Output:
62 * void foo(){} void bar() {
63 *
64 */
65 wxString GetVisibleScope(const wxString& inputString);
66
67 /**
68 * @brief return true if the current scanner position is placed inside a PP section
69 */
70 bool IsInPreProcessorSection() const;
71
72 /**
73 * @brief read until we find `type_1` or `type_2`. Return the string consumed. This function
74 * consumes the delimiter found (`type_1` or `type_2`)
75 * @param what_was_found return value
76 * @return string consumed until delimiter found
77 */
78 void read_until_find(CxxLexerToken& token, int type_1, int type_2, int* what_was_found, wxString* consumed);
79 };
80
81 #endif // CXXTOKENIZER_H