2009-07-14 00:45:15 +04:00
|
|
|
/*
|
2014-11-25 06:37:59 +03:00
|
|
|
* Copyright 2014, Rene Gollent, rene@gollent.com.
|
2009-07-14 00:45:15 +04:00
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef SYNTAX_HIGHLIGHTER_H
|
|
|
|
#define SYNTAX_HIGHLIGHTER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
#include <Referenceable.h>
|
|
|
|
|
|
|
|
|
2014-11-25 06:37:59 +03:00
|
|
|
class LineDataSource;
|
2015-01-02 01:19:08 +03:00
|
|
|
class TeamTypeInformation;
|
2009-07-14 00:45:15 +04:00
|
|
|
|
|
|
|
|
2014-11-25 06:37:59 +03:00
|
|
|
enum syntax_highlight_type {
|
|
|
|
SYNTAX_HIGHLIGHT_NONE = 0,
|
|
|
|
SYNTAX_HIGHLIGHT_KEYWORD,
|
|
|
|
SYNTAX_HIGHLIGHT_PREPROCESSOR_KEYWORD,
|
|
|
|
SYNTAX_HIGHLIGHT_IDENTIFIER,
|
|
|
|
SYNTAX_HIGHLIGHT_OPERATOR,
|
|
|
|
SYNTAX_HIGHLIGHT_TYPE,
|
|
|
|
SYNTAX_HIGHLIGHT_NUMERIC_LITERAL,
|
|
|
|
SYNTAX_HIGHLIGHT_STRING_LITERAL,
|
|
|
|
SYNTAX_HIGHLIGHT_COMMENT
|
2009-07-14 00:45:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SyntaxHighlightInfo {
|
2014-11-25 06:37:59 +03:00
|
|
|
public:
|
2009-07-14 00:45:15 +04:00
|
|
|
virtual ~SyntaxHighlightInfo();
|
|
|
|
|
|
|
|
virtual int32 GetLineHighlightRanges(int32 line,
|
|
|
|
int32* _columns,
|
|
|
|
syntax_highlight_type* _types,
|
|
|
|
int32 maxCount) = 0;
|
|
|
|
// Returns number of filled in
|
|
|
|
// (column, type) pairs.
|
|
|
|
// Default is (0, SYNTAX_HIGHLIGHT_NONE)
|
|
|
|
// and can be omitted.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-16 16:50:30 +03:00
|
|
|
class SyntaxHighlighter : public BReferenceable {
|
2009-07-14 00:45:15 +04:00
|
|
|
public:
|
|
|
|
virtual ~SyntaxHighlighter();
|
|
|
|
|
2014-11-25 06:37:59 +03:00
|
|
|
virtual status_t ParseText(LineDataSource* source,
|
2015-01-02 01:19:08 +03:00
|
|
|
TeamTypeInformation* typeInfo,
|
2009-07-14 00:45:15 +04:00
|
|
|
SyntaxHighlightInfo*& _info) = 0;
|
|
|
|
// caller owns the returned info
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SYNTAX_HIGHLIGHTER_H
|