Changeset View
Changeset View
Standalone View
Standalone View
debuggers/common/mi/miparser.h
- This file was moved from debuggers/gdb/mi/miparser.h.
Show All 16 Lines | |||||
17 | * Free Software Foundation, Inc., * | 17 | * Free Software Foundation, Inc., * | ||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | ||
19 | ***************************************************************************/ | 19 | ***************************************************************************/ | ||
20 | #ifndef MIPARSER_H | 20 | #ifndef MIPARSER_H | ||
21 | #define MIPARSER_H | 21 | #define MIPARSER_H | ||
22 | 22 | | |||
23 | #include <memory> | 23 | #include <memory> | ||
24 | 24 | | |||
25 | #include "mi.h" | ||||
25 | #include "milexer.h" | 26 | #include "milexer.h" | ||
26 | #include "gdbmi.h" | | |||
27 | 27 | | |||
28 | #include <QString> | 28 | #include <QString> | ||
29 | 29 | | |||
30 | namespace KDevMI { namespace MI { | ||||
31 | | ||||
30 | /** | 32 | /** | ||
31 | @author Roberto Raggi | 33 | @author Roberto Raggi | ||
32 | */ | 34 | */ | ||
33 | class MIParser | 35 | class MIParser | ||
34 | { | 36 | { | ||
35 | public: | 37 | public: | ||
36 | MIParser(); | 38 | MIParser(); | ||
37 | ~MIParser(); | 39 | ~MIParser(); | ||
38 | 40 | | |||
39 | std::unique_ptr<GDBMI::Record> parse(FileSymbol *file); | 41 | std::unique_ptr<Record> parse(FileSymbol *file); | ||
40 | 42 | | |||
41 | protected: // rules | 43 | protected: // rules | ||
42 | std::unique_ptr<GDBMI::Record> parseResultOrAsyncRecord(); | 44 | std::unique_ptr<Record> parseResultOrAsyncRecord(); | ||
43 | std::unique_ptr<GDBMI::Record> parsePrompt(); | 45 | std::unique_ptr<Record> parsePrompt(); | ||
44 | std::unique_ptr<GDBMI::Record> parseStreamRecord(); | 46 | std::unique_ptr<Record> parseStreamRecord(); | ||
45 | 47 | | |||
46 | bool parseResult(GDBMI::Result *&result); | 48 | bool parseResult(Result *&result); | ||
47 | bool parseValue(GDBMI::Value *&value); | 49 | bool parseValue(Value *&value); | ||
48 | bool parseTuple(GDBMI::Value *&value); | 50 | bool parseTuple(Value *&value); | ||
49 | bool parseList(GDBMI::Value *&value); | 51 | bool parseList(Value *&value); | ||
50 | 52 | | |||
51 | /** Creates new TupleValue object, writes its address | 53 | /** Creates new TupleValue object, writes its address | ||
52 | into *value, parses a comma-separated set of values, | 54 | into *value, parses a comma-separated set of values, | ||
53 | and adds each new value into (*value)->results. | 55 | and adds each new value into (*value)->results. | ||
54 | If 'start' and 'end' are not zero, they specify | 56 | If 'start' and 'end' are not zero, they specify | ||
55 | start and end delimiter of the list. | 57 | start and end delimiter of the list. | ||
56 | Parsing stops when we see 'end' character, or, if | 58 | Parsing stops when we see 'end' character, or, if | ||
57 | 'end' is zero, at the end of input. | 59 | 'end' is zero, at the end of input. | ||
58 | */ | 60 | */ | ||
59 | bool parseCSV(GDBMI::TupleValue** value, | 61 | bool parseCSV(TupleValue** value, | ||
60 | char start = 0, char end = 0); | 62 | char start = 0, char end = 0); | ||
61 | 63 | | |||
62 | /** @overload | 64 | /** @overload | ||
63 | Same as above, but writes into existing tuple. | 65 | Same as above, but writes into existing tuple. | ||
64 | */ | 66 | */ | ||
65 | bool parseCSV(GDBMI::TupleValue& value, | 67 | bool parseCSV(TupleValue& value, | ||
66 | char start = 0, char end = 0); | 68 | char start = 0, char end = 0); | ||
67 | 69 | | |||
68 | | ||||
69 | /** Parses a string literal and returns it. Advances | 70 | /** Parses a string literal and returns it. Advances | ||
70 | the lexer past the literal. Processes C escape sequences | 71 | the lexer past the literal. Processes C escape sequences | ||
71 | in the string. | 72 | in the string. | ||
72 | @pre lex->lookAhead(0) == Token_string_literal | 73 | @pre lex->lookAhead(0) == Token_string_literal | ||
73 | */ | 74 | */ | ||
74 | QString parseStringLiteral(); | 75 | QString parseStringLiteral(); | ||
75 | 76 | | |||
76 | | ||||
77 | | ||||
78 | private: | 77 | private: | ||
79 | MILexer m_lexer; | 78 | MILexer m_lexer; | ||
80 | TokenStream *m_lex; | 79 | TokenStream *m_lex; | ||
81 | }; | 80 | }; | ||
82 | 81 | | |||
82 | } // end of namespace MI | ||||
83 | } // end of namespace KDevMI | ||||
84 | | ||||
83 | #endif | 85 | #endif |