xref: /haiku/src/kits/debugger/source_language/c_family/CLanguageFamilySyntaxHighlightInfo.h (revision 815212800210a100d07c2c3d8dfea18360426319)
1 /*
2  * Copyright 2014, Rene Gollent, rene@gollent.com.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHT_INFO_H
6 #define C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHT_INFO_H
7 
8 
9 #include "SyntaxHighlighter.h"
10 
11 #include <ObjectList.h>
12 
13 
14 namespace CLanguage {
15 	struct Token;
16 	class Tokenizer;
17 }
18 
19 class TeamTypeInformation;
20 
21 
22 class CLanguageFamilySyntaxHighlightInfo : public SyntaxHighlightInfo {
23 public:
24 								CLanguageFamilySyntaxHighlightInfo(
25 									LineDataSource* source,
26 									CLanguage::Tokenizer* tokenizer,
27 									TeamTypeInformation* info);
28 	virtual						~CLanguageFamilySyntaxHighlightInfo();
29 
30 	virtual	int32				GetLineHighlightRanges(int32 line,
31 									int32* _columns,
32 									syntax_highlight_type* _types,
33 									int32 maxCount);
34 
35 private:
36 	class LineInfo;
37 	typedef BObjectList<LineInfo> LineInfoList;
38 	struct SyntaxPair;
39 
40 private:
41 			status_t			_ParseLines();
42 			status_t			_ParseLine(int32 line,
43 									syntax_highlight_type& _lastType,
44 									LineInfo*& _info);
45 			syntax_highlight_type _MapTokenToSyntaxType(
46 									const CLanguage::Token& token);
47 private:
48 	LineDataSource*				fHighlightSource;
49 	CLanguage::Tokenizer*		fTokenizer;
50 	TeamTypeInformation*		fTypeInfo;
51 	LineInfoList				fLineInfos;
52 };
53 
54 
55 #endif	// C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHT_INFO_H
56