Debugger: Add skeleton C/C++ syntax highlighter classes.

This commit is contained in:
Rene Gollent 2014-11-24 23:01:52 -05:00
parent d431ff418f
commit c04274bdd3
6 changed files with 127 additions and 2 deletions

View File

@ -28,6 +28,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) settings ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) settings generic ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) source_language ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) source_language expression_evaluators ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) source_language syntax_highlighters ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) types ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface cli ] ;
@ -221,6 +222,10 @@ Application Debugger :
# source_language/expression_evaluators
CLanguageExpressionEvaluator.cpp
# source_language/syntax_highlighters
CLanguageFamilySyntaxHighlighter.cpp
CLanguageFamilySyntaxHighlightInfo.cpp
# types
ArrayIndexPath.cpp
TargetAddressRangeList.cpp

View File

@ -11,6 +11,7 @@
#include <stdlib.h>
#include "CLanguageExpressionEvaluator.h"
#include "CLanguageFamilySyntaxHighlighter.h"
#include "ExpressionInfo.h"
#include "TeamTypeInformation.h"
#include "StringValue.h"
@ -32,8 +33,7 @@ CLanguageFamily::~CLanguageFamily()
SyntaxHighlighter*
CLanguageFamily::GetSyntaxHighlighter() const
{
// TODO:...
return NULL;
return new(std::nothrow) CLanguageFamilySyntaxHighlighter();
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "CLanguageFamilySyntaxHighlightInfo.h"
#include "LineDataSource.h"
CLanguageFamilySyntaxHighlightInfo::CLanguageFamilySyntaxHighlightInfo(
LineDataSource* source)
:
SyntaxHighlightInfo(),
fHighlightSource(source)
{
fHighlightSource->AcquireReference();
}
CLanguageFamilySyntaxHighlightInfo::~CLanguageFamilySyntaxHighlightInfo()
{
fHighlightSource->ReleaseReference();
}
int32
CLanguageFamilySyntaxHighlightInfo::GetLineHighlightRanges(int32 line,
int32* _columns, syntax_highlight_type* _types, int32 maxCount)
{
// TODO: implement
return 0;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHT_INFO_H
#define C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHT_INFO_H
#include "SyntaxHighlighter.h"
class CLanguageFamilySyntaxHighlightInfo : public SyntaxHighlightInfo {
public:
CLanguageFamilySyntaxHighlightInfo(
LineDataSource* source);
virtual ~CLanguageFamilySyntaxHighlightInfo();
virtual int32 GetLineHighlightRanges(int32 line,
int32* _columns,
syntax_highlight_type* _types,
int32 maxCount);
private:
LineDataSource* fHighlightSource;
};
#endif // C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHT_INFO_H

View File

@ -0,0 +1,35 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "CLanguageFamilySyntaxHighlighter.h"
#include <new>
#include "CLanguageFamilySyntaxHighlightInfo.h"
CLanguageFamilySyntaxHighlighter::CLanguageFamilySyntaxHighlighter()
:
SyntaxHighlighter()
{
}
CLanguageFamilySyntaxHighlighter::~CLanguageFamilySyntaxHighlighter()
{
}
status_t
CLanguageFamilySyntaxHighlighter::ParseText(LineDataSource* source,
SyntaxHighlightInfo*& _info)
{
_info = new(std::nothrow) CLanguageFamilySyntaxHighlightInfo(source);
if (_info == NULL)
return B_NO_MEMORY;
return B_OK;
}

View File

@ -0,0 +1,23 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHTER_H
#define C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHTER_H
#include "SyntaxHighlighter.h"
class CLanguageFamilySyntaxHighlighter : public SyntaxHighlighter {
public:
CLanguageFamilySyntaxHighlighter();
virtual ~CLanguageFamilySyntaxHighlighter();
virtual status_t ParseText(LineDataSource* source,
SyntaxHighlightInfo*& _info);
// caller owns the returned info
};
#endif // C_LANGUAGE_FAMILY_SYNTAX_HIGHLIGHTER_H