mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Find debugging log improvement, Core: CParser::SkipLine
This commit is contained in:
parent
a39b26b20f
commit
2cde5203ad
5 changed files with 57 additions and 5 deletions
|
|
@ -73,6 +73,7 @@ public:
|
|||
|
||||
void Skip();
|
||||
void SkipTerm() { Skip(); }
|
||||
void SkipLine();
|
||||
|
||||
struct Pos {
|
||||
const char *ptr;
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ void CParser::Skip()
|
|||
term++;
|
||||
else
|
||||
if(IsString())
|
||||
ReadString();
|
||||
ReadString(false);
|
||||
else
|
||||
if(IsChar('\''))
|
||||
ReadString('\'', false);
|
||||
|
|
@ -564,6 +564,19 @@ void CParser::Skip()
|
|||
DoSpaces();
|
||||
}
|
||||
|
||||
void CParser::SkipLine()
|
||||
{
|
||||
while(*term) {
|
||||
if(*term == '\n') {
|
||||
line++;
|
||||
lineptr = term + 1;
|
||||
term++;
|
||||
break;
|
||||
}
|
||||
term++;
|
||||
}
|
||||
}
|
||||
|
||||
CParser::Pos CParser::GetPos() const
|
||||
{
|
||||
Pos p;
|
||||
|
|
|
|||
|
|
@ -373,6 +373,11 @@ is advanced by 1 character.&]
|
|||
[s2;%% Same as Skip, legacy name.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:CParser`:`:SkipLine`(`): [@(0.0.255) void] [* SkipLine]()&]
|
||||
[s2;%% Skips everything from current position to the end of line.
|
||||
.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:CParser`:`:GetPtr`(`)const: [@(0.0.255) const]_[@(0.0.255) char]_`*[* GetPtr]()_[@(0.0.255) c
|
||||
onst]&]
|
||||
[s2;%% Returns a pointer to the current position.&]
|
||||
|
|
|
|||
|
|
@ -200,7 +200,6 @@ void Ide::EditSpecial(Bar& menu)
|
|||
.Help("Comment code lines");
|
||||
menu.Add(b && editor.IsSelection(), AK_UNCOMMENT, THISBACK(UnComment))
|
||||
.Help("Uncomment code");
|
||||
FindDs(menu);
|
||||
menu.MenuSeparator();
|
||||
menu.Add(AK_COPY_POSITION, [=] { CopyPosition(); });
|
||||
menu.Add(AK_GOTO_POSITION, [=] { GotoPosition(); });
|
||||
|
|
|
|||
|
|
@ -534,9 +534,6 @@ void Ide::FindDs(int where)
|
|||
{
|
||||
SaveFile();
|
||||
|
||||
static Index<String> ds = { "DLOG", "DDUMP", "DDUMPC", "DDUMPM", "DTIMING",
|
||||
"DLOGHEX", "DDUMPHEX", "DTIMESTOP", "DHITCOUNT" };
|
||||
|
||||
NewFFound();
|
||||
|
||||
String nest_dir = GetPathNest(editfile);
|
||||
|
|
@ -567,6 +564,42 @@ void Ide::FindDs(int where)
|
|||
for(String fn : files) {
|
||||
if(pi.SetCanceled(n++, files.GetCount()))
|
||||
break;
|
||||
|
||||
if(GetFileLength(fn) < 10*1024*1024) {
|
||||
String text = LoadFile(fn);
|
||||
try {
|
||||
CParser p(text);
|
||||
bool ignore = false;
|
||||
while(!p.IsEof()) {
|
||||
CParser::Pos pos = p.GetPos();
|
||||
if(p.Char('#')) {
|
||||
if(p.Id("if") || p.Id("ifdef"))
|
||||
ignore = true;
|
||||
else
|
||||
if(p.Id("endif"))
|
||||
ignore = false;
|
||||
p.SkipLine();
|
||||
}
|
||||
else
|
||||
if(p.IsId()) {
|
||||
static Index<String> ds = { "DLOG", "DDUMP", "DDUMPC", "DDUMPM", "DTIMING",
|
||||
"DLOGHEX", "DDUMPHEX", "DTIMESTOP", "DHITCOUNT" };
|
||||
String id = p.ReadId();
|
||||
if(ds.Find(id) >= 0 && p.Char('(') && !ignore) {
|
||||
String line;
|
||||
for(const char *s = pos.lineptr; findarg(*s, '\0', '\r', '\n') < 0; s++)
|
||||
line.Cat(*s);
|
||||
AddFoundFile(fn, pos.line, line, pos.ptr - pos.lineptr, id.GetCount());
|
||||
}
|
||||
}
|
||||
else
|
||||
p.Skip();
|
||||
}
|
||||
}
|
||||
catch(CParser::Error) {}
|
||||
}
|
||||
}
|
||||
/*
|
||||
FileIn in(fn);
|
||||
int line = 0;
|
||||
while(!in.IsEof()) {
|
||||
|
|
@ -590,6 +623,7 @@ void Ide::FindDs(int where)
|
|||
catch(CParser::Error) {}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
FFoundFinish();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue