error whith the Highlight detection
This commit is contained in:
parent
322120a3f3
commit
45b4dca615
@ -57,12 +57,14 @@ class Buffer {
|
|||||||
{
|
{
|
||||||
m_fileName = newName;
|
m_fileName = newName;
|
||||||
m_haveName = true;
|
m_haveName = true;
|
||||||
|
NameChange();
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetFileName(Edn::String &newName)
|
void SetFileName(Edn::String &newName)
|
||||||
{
|
{
|
||||||
m_fileName.SetCompleateName(newName);
|
m_fileName.SetCompleateName(newName);
|
||||||
m_haveName = true;
|
m_haveName = true;
|
||||||
|
NameChange();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool HaveName(void)
|
bool HaveName(void)
|
||||||
@ -74,6 +76,7 @@ class Buffer {
|
|||||||
bool IsModify(void);
|
bool IsModify(void);
|
||||||
protected:
|
protected:
|
||||||
void SetModify(bool status);
|
void SetModify(bool status);
|
||||||
|
virtual void NameChange(void) { /*EDN_DEBUG("check name change ==> no HL change possible");*/};
|
||||||
public:
|
public:
|
||||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||||
virtual void SetLineDisplay(uint32_t lineNumber);
|
virtual void SetLineDisplay(uint32_t lineNumber);
|
||||||
|
@ -74,6 +74,29 @@ void BufferText::BasicInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param[in,out] ---
|
||||||
|
*
|
||||||
|
* @return ---
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void BufferText::NameChange(void)
|
||||||
|
{
|
||||||
|
// Find HL system
|
||||||
|
//EDN_DEBUG("check name change");
|
||||||
|
if (true == HighlightManager::getInstance()->Exist(m_fileName)) {
|
||||||
|
Highlight * myHL = HighlightManager::getInstance()->Get(m_fileName);
|
||||||
|
// Set the new HL
|
||||||
|
if (NULL != myHL) {
|
||||||
|
m_EdnBuf.SetHLSystem(myHL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@ -101,6 +124,7 @@ BufferText::BufferText()
|
|||||||
BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
||||||
{
|
{
|
||||||
BasicInit();
|
BasicInit();
|
||||||
|
NameChange();
|
||||||
EDN_INFO("Add Data from file(" << GetFileName() << ")");
|
EDN_INFO("Add Data from file(" << GetFileName() << ")");
|
||||||
FILE * myFile = NULL;
|
FILE * myFile = NULL;
|
||||||
// try to open the file. if not existed, new file
|
// try to open the file. if not existed, new file
|
||||||
|
@ -73,6 +73,8 @@ class BufferText : public Buffer {
|
|||||||
void Undo(void);
|
void Undo(void);
|
||||||
void Redo(void);
|
void Redo(void);
|
||||||
void SetCharset(charset_te newCharset);
|
void SetCharset(charset_te newCharset);
|
||||||
|
protected:
|
||||||
|
void NameChange(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Display
|
// Display
|
||||||
|
@ -52,7 +52,7 @@ Highlight::Highlight(Edn::String &xmlFilename)
|
|||||||
// open the curent File
|
// open the curent File
|
||||||
bool loadError = XmlDocument.LoadFile(xmlFilename.c_str());
|
bool loadError = XmlDocument.LoadFile(xmlFilename.c_str());
|
||||||
if (false == loadError) {
|
if (false == loadError) {
|
||||||
EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename.c_str() << "\"");
|
EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename << "\"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnLang" );
|
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnLang" );
|
||||||
@ -134,24 +134,17 @@ bool Highlight::HasExtention(Edn::String &ext)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Highlight::FileNameCompatible(Edn::String &fileName)
|
bool Highlight::FileNameCompatible(Edn::File &fileName)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int32_t posCopy = fileName.FindBack('/');
|
|
||||||
Edn::String shortFilename;
|
|
||||||
if (-1 != posCopy) {
|
|
||||||
shortFilename = fileName.Extract(posCopy+1);
|
|
||||||
} else {
|
|
||||||
shortFilename = fileName;
|
|
||||||
}
|
|
||||||
posCopy = shortFilename.FindBack('.');
|
|
||||||
Edn::String extention;
|
Edn::String extention;
|
||||||
if (-1 != posCopy) {
|
if (true == fileName.HasExtention() ) {
|
||||||
extention = shortFilename.Extract(posCopy);
|
extention = "*.";
|
||||||
|
extention += fileName.GetExtention();
|
||||||
} else {
|
} else {
|
||||||
extention = shortFilename;
|
extention = fileName.GetShortFilename();
|
||||||
}
|
}
|
||||||
EDN_DEBUG(" try to find : in \"" << fileName.c_str() << "\" shortfilename\"" << shortFilename.c_str() << "\" extention:\"" << extention.c_str() << "\" ");
|
EDN_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
|
||||||
|
|
||||||
for (i=0; i<m_listExtentions.size(); i++) {
|
for (i=0; i<m_listExtentions.size(); i++) {
|
||||||
if (extention == m_listExtentions[i] ) {
|
if (extention == m_listExtentions[i] ) {
|
||||||
@ -167,16 +160,16 @@ void Highlight::Display(void)
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
EDN_INFO("List of ALL Highlight : ");
|
EDN_INFO("List of ALL Highlight : ");
|
||||||
for (i=0; i< m_listExtentions.size(); i++) {
|
for (i=0; i< m_listExtentions.size(); i++) {
|
||||||
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i].c_str() );
|
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i] );
|
||||||
}
|
}
|
||||||
// Display all elements
|
// Display all elements
|
||||||
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
||||||
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName().c_str() );
|
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() );
|
||||||
//m_listHighlightPass1[i]->Display();
|
//m_listHighlightPass1[i]->Display();
|
||||||
}
|
}
|
||||||
// Display all elements
|
// Display all elements
|
||||||
for (i=0; i< m_listHighlightPass2.size(); i++) {
|
for (i=0; i< m_listHighlightPass2.size(); i++) {
|
||||||
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName().c_str() );
|
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
|
||||||
//m_listHighlightPass2[i]->Display();
|
//m_listHighlightPass2[i]->Display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class Highlight {
|
|||||||
Highlight(Edn::String &xmlFilename);
|
Highlight(Edn::String &xmlFilename);
|
||||||
~Highlight(void);
|
~Highlight(void);
|
||||||
bool HasExtention(Edn::String &ext);
|
bool HasExtention(Edn::String &ext);
|
||||||
bool FileNameCompatible(Edn::String &fileName);
|
bool FileNameCompatible(Edn::File &fileName);
|
||||||
void Display(void);
|
void Display(void);
|
||||||
void Parse( int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID=0);
|
void Parse( int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID=0);
|
||||||
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0);
|
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0);
|
||||||
|
@ -41,7 +41,7 @@ HighlightManager::~HighlightManager(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Highlight *HighlightManager::Get(Edn::String &fileName)
|
Highlight *HighlightManager::Get(Edn::File &fileName)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i=0; i<listHighlight.size(); i++) {
|
for (i=0; i<listHighlight.size(); i++) {
|
||||||
@ -52,13 +52,10 @@ Highlight *HighlightManager::Get(Edn::String &fileName)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HighlightManager::Exist(Edn::String &fileName)
|
bool HighlightManager::Exist(Edn::File &fileName)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
if (NULL != Get(fileName) ) {
|
||||||
for (i=0; i<listHighlight.size(); i++) {
|
return true;
|
||||||
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ class HighlightManager: public Singleton<HighlightManager>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void loadLanguages(void);
|
void loadLanguages(void);
|
||||||
Highlight * Get(Edn::String &fileName);
|
Highlight * Get(Edn::File &fileName);
|
||||||
bool Exist(Edn::String &fileName);
|
bool Exist(Edn::File &fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
|
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
|
||||||
|
@ -98,10 +98,10 @@ bool HighlightPattern::IsEnable(void)
|
|||||||
void HighlightPattern::Display(void)
|
void HighlightPattern::Display(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
EDN_INFO("patern : \"" << m_paternName.c_str() << "\" level=" << m_level );
|
EDN_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
|
||||||
EDN_INFO(" ==> colorName \"" << m_colorName.c_str() << "\"");
|
EDN_INFO(" ==> colorName \"" << m_colorName << "\"");
|
||||||
EDN_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp().c_str() << "\"");
|
EDN_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp() << "\"");
|
||||||
EDN_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp().c_str() << "\"");
|
EDN_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp() << "\"");
|
||||||
if (true == m_haveStopPatern) {
|
if (true == m_haveStopPatern) {
|
||||||
EDN_INFO(" ==> stop pattern: YES");
|
EDN_INFO(" ==> stop pattern: YES");
|
||||||
} else {
|
} else {
|
||||||
@ -115,7 +115,7 @@ void HighlightPattern::Display(void)
|
|||||||
*/
|
*/
|
||||||
// Display all elements
|
// Display all elements
|
||||||
for (int32_t i=0; i< m_subPatern.Size(); i++) {
|
for (int32_t i=0; i< m_subPatern.Size(); i++) {
|
||||||
EDN_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName().c_str() );
|
EDN_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
|
||||||
m_subPatern[i]->Display();
|
m_subPatern[i]->Display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,3 +213,31 @@ int32_t Edn::File::GetLineNumber(void)
|
|||||||
return m_lineNumberOpen;
|
return m_lineNumberOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Edn::File::HasExtention(void)
|
||||||
|
{
|
||||||
|
int32_t lastPos = m_shortFilename.FindBack('.');
|
||||||
|
if( -1 != lastPos // not find the .
|
||||||
|
&& 0 != lastPos // Find a . at the fist position .jdlskjdfklj ==> hiden file
|
||||||
|
&& m_shortFilename.Size() != lastPos ) // Remove file ended with .
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Edn::String Edn::File::GetExtention(void)
|
||||||
|
{
|
||||||
|
Edn::String tmpExt = "";
|
||||||
|
int32_t lastPos = m_shortFilename.FindBack('.');
|
||||||
|
if( -1 != lastPos // not find the .
|
||||||
|
&& 0 != lastPos // Find a . at the fist position .jdlskjdfklj ==> hiden file
|
||||||
|
&& m_shortFilename.Size() != lastPos ) // Remove file ended with .
|
||||||
|
{
|
||||||
|
// Get the FileName
|
||||||
|
tmpExt = m_shortFilename.Extract(lastPos+1);
|
||||||
|
}
|
||||||
|
return tmpExt;
|
||||||
|
}
|
||||||
|
@ -39,6 +39,8 @@ namespace Edn
|
|||||||
Edn::String GetFolder(void) const;
|
Edn::String GetFolder(void) const;
|
||||||
Edn::String GetShortFilename(void) const;
|
Edn::String GetShortFilename(void) const;
|
||||||
Edn::String GetCompleateName(void) const;
|
Edn::String GetCompleateName(void) const;
|
||||||
|
bool HasExtention(void);
|
||||||
|
Edn::String GetExtention(void);
|
||||||
int32_t GetLineNumber(void);
|
int32_t GetLineNumber(void);
|
||||||
void SetCompleateName(Edn::String &newFilename);
|
void SetCompleateName(Edn::String &newFilename);
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<EdnLang version="0.1" lang="c">
|
<EdnLang version="0.1" lang="c">
|
||||||
<ext>Makefile</ext>
|
<ext>Makefile</ext>
|
||||||
<ext>.mk</ext>
|
<ext>*.mk</ext>
|
||||||
|
<ext>*.global</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<EdnLang version="0.1" lang="Assembleur">
|
<EdnLang version="0.1" lang="Assembleur">
|
||||||
<ext>.s</ext>
|
<ext>*.s</ext>
|
||||||
<ext>.S</ext>
|
<ext>*.S</ext>
|
||||||
<ext>.asm</ext>
|
<ext>*.asm</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline doxygen">
|
<rule name="my comment multiline doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<EdnLang version="0.1" lang="c">
|
<EdnLang version="0.1" lang="c">
|
||||||
<ext>.boo</ext>
|
<ext>*.boo</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<EdnLang version="0.1" lang="c">
|
<EdnLang version="0.1" lang="c">
|
||||||
<ext>.c</ext>
|
<ext>*.c</ext>
|
||||||
<ext>.cpp</ext>
|
<ext>*.cpp</ext>
|
||||||
<ext>.h</ext>
|
<ext>*.h</ext>
|
||||||
<ext>.hpp</ext>
|
<ext>*.hpp</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline doxygen">
|
<rule name="my comment multiline doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<EdnLang version="0.1" lang="c">
|
<EdnLang version="0.1" lang="c">
|
||||||
<ext>.php</ext>
|
<ext>*.php</ext>
|
||||||
<ext>.php3</ext>
|
<ext>*.php3</ext>
|
||||||
<ext>.php4</ext>
|
<ext>*.php4</ext>
|
||||||
<ext>.phtml</ext>
|
<ext>*.phtml</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<EdnLang version="0.1" lang="Assembleur">
|
<EdnLang version="0.1" lang="Assembleur">
|
||||||
<ext>.xml</ext>
|
<ext>*.xml</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="Comment">
|
<rule name="Comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user