Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Disable Assits++ scan on certain files
Re: Disable Assits++ scan on certain files [message #52297 is a reply to message #51272] |
Sun, 01 September 2019 00:20   |
Didier
Messages: 726 Registered: November 2008 Location: France
|
Contributor |
|
|
Well I finally found some time to look into this problem and actually found something that works.
Code is just a first quick try, but before going further I would like to share it first and have some return on it.
* in uppsrc/CppBase/CppBase.h
const char *SkipString(const char *s);
void RemoveComments(String& l, bool& incomment);
void RemoveDirectives(String& l, bool& inDirective); // ======= ADDED THIS LINE ============
String GetStdDefs();
* in uppsrc/CppBase/ppFile.cpp
Added the following function:
void RemoveDirectives(String& l, bool& inDirective)
{
int q = -1;
int w = -1;
if(inDirective)
q = w = 0;
else {
const char *s = l;
while(*s) {
if(*s == '\"')
s = SkipString(s);
else
if(s[0] == '/' && s[1] == '/' && s[2] == '$' && s[3] == '-') {
q = int(s - ~l);
break;
}
else
s++;
}
if(q >= 0)
w = q + 4;
}
while(q >= 0) {
int eq = l.Find("//$+", w);
if(eq < 0) {
inDirective = true;
SetSpaces(l, q, l.GetCount() - q);
return;
}
SetSpaces(l, q, eq + 4 - q);
inDirective = false;
q = l.Find("//$+");
w = q + 4;
}
}
* Modified ppFile::parse() method
void PPFile::Parse(Stream& in)
{
LTIMING("PPFile::Parse");
for(int i = 0; i < ppmacro.GetCount(); i++)
sAllMacros.Unlink(ppmacro[i]);
ppmacro.Clear();
item.Clear();
includes.Clear();
bool was_using = false;
bool was_namespace = false;
int level = 0;
bool incomment = false;
bool inDirective = false; ========== line added ===========
Vector<int> namespace_block;
bool next_segment = true;
Index<int> local_segments;
keywords.Clear();
int linei = 0;
Md5Stream md5;
while(!in.IsEof()) {
String l = in.GetLine();
while(*l.Last() == '\\' && !in.IsEof()) {
l.Trim(l.GetLength() - 1);
l.Cat(in.GetLine());
}
RemoveDirectives(l, inDirective); ========== line added =========
RemoveComments(l, incomment);
try {
CParser p(l);
|
|
|
 |
|
Disable Assits++ scan on certain files
By: Didier on Fri, 07 December 2018 19:42
|
 |
|
Re: Disable Assits++ scan on certain files
By: Klugier on Sat, 08 December 2018 18:40
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Sat, 08 December 2018 19:11
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Sat, 08 December 2018 19:12
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Tue, 26 February 2019 22:13
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Sun, 01 September 2019 00:20
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Sun, 01 September 2019 00:21
|
 |
|
Re: Disable Assits++ scan on certain files
By: mirek on Fri, 06 September 2019 11:03
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Fri, 06 September 2019 12:44
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Fri, 06 September 2019 21:39
|
 |
|
Re: Disable Assits++ scan on certain files
By: mirek on Mon, 09 September 2019 08:16
|
 |
|
Re: Disable Assits++ scan on certain files
By: Didier on Tue, 10 September 2019 20:06
|
 |
|
Re: Disable Assits++ scan on certain files
By: mirek on Tue, 10 September 2019 23:04
|
 |
 |
Re: Disable Assits++ scan on certain files
By: Didier on Tue, 10 September 2019 23:54
|
 |
|
Re: Disable Assits++ scan on certain files
By: mirek on Wed, 11 September 2019 09:38
|
Goto Forum:
Current Time: Mon May 12 18:10:32 CEST 2025
Total time taken to generate the page: 0.00555 seconds
|