vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / source_language / SyntaxHighlighter.h
blob0fae05aa93beb3661640211b0304c427518b2181
1 /*
2 * Copyright 2014, Rene Gollent, rene@gollent.com.
3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef SYNTAX_HIGHLIGHTER_H
7 #define SYNTAX_HIGHLIGHTER_H
10 #include <String.h>
12 #include <Referenceable.h>
15 class LineDataSource;
16 class TeamTypeInformation;
19 enum syntax_highlight_type {
20 SYNTAX_HIGHLIGHT_NONE = 0,
21 SYNTAX_HIGHLIGHT_KEYWORD,
22 SYNTAX_HIGHLIGHT_PREPROCESSOR_KEYWORD,
23 SYNTAX_HIGHLIGHT_IDENTIFIER,
24 SYNTAX_HIGHLIGHT_OPERATOR,
25 SYNTAX_HIGHLIGHT_TYPE,
26 SYNTAX_HIGHLIGHT_NUMERIC_LITERAL,
27 SYNTAX_HIGHLIGHT_STRING_LITERAL,
28 SYNTAX_HIGHLIGHT_COMMENT
32 class SyntaxHighlightInfo {
33 public:
34 virtual ~SyntaxHighlightInfo();
36 virtual int32 GetLineHighlightRanges(int32 line,
37 int32* _columns,
38 syntax_highlight_type* _types,
39 int32 maxCount) = 0;
40 // Returns number of filled in
41 // (column, type) pairs.
42 // Default is (0, SYNTAX_HIGHLIGHT_NONE)
43 // and can be omitted.
47 class SyntaxHighlighter : public BReferenceable {
48 public:
49 virtual ~SyntaxHighlighter();
51 virtual status_t ParseText(LineDataSource* source,
52 TeamTypeInformation* typeInfo,
53 SyntaxHighlightInfo*& _info) = 0;
54 // caller owns the returned info
58 #endif // SYNTAX_HIGHLIGHTER_H