symlist, support for unittests

This commit is contained in:
Basile Burg 2016-04-24 02:17:15 +02:00
parent 4800a23fab
commit 0d658711bc
3 changed files with 30 additions and 12 deletions

View File

@ -23,7 +23,7 @@ Usage
module cesyms;
import std.stdio, std.path, std.file, std.array, std.string;
import std.getopt, std.json, std.conv;
import std.getopt, std.json, std.conv, std.format;
import dparse.lexer, dparse.ast, dparse.parser, dparse.rollback_allocator;
import std.traits;
@ -161,6 +161,7 @@ enum SymbolType
_struct,
_template,
_union,
_unittest,
_variable,
_warning
}
@ -179,6 +180,8 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
static JSONValue* jarray;
}
static uint utc;
alias visit = ASTVisitor.visit;
static this()
@ -412,6 +415,12 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
namedVisitorImpl!(UnionDeclaration, SymbolType._union)(decl);
}
final override void visit(const Unittest decl)
{
otherVisitorImpl(decl, SymbolType._unittest, format("test%.4d",utc++),
decl.line, decl.column);
}
final override void visit(const VariableDeclaration decl)
{
if (decl.declarators)

View File

@ -36,7 +36,7 @@ inherited CESymbolListWidget: TCESymbolListWidget
OnKeyPress = TreeKeyPress
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
Items.Data = {
F9FFFFFF02000D000000000000000000000000000000FFFFFFFF000000000000
F9FFFFFF02000E000000000000000000000000000000FFFFFFFF000000000000
00000005000000416C696173010000000100000001000000FFFFFFFF00000000
000000000005000000436C617373020000000200000002000000FFFFFFFF0000
0000000000000004000000456E756D030000000300000003000000FFFFFFFF00
@ -48,9 +48,10 @@ inherited CESymbolListWidget: TCESymbolListWidget
6374080000000800000008000000FFFFFFFF0000000000000000000800000054
656D706C617465000000000000000000000000FFFFFFFF000000000000000000
05000000556E696F6E010000000100000001000000FFFFFFFF00000000000000
0000080000005661726961626C65090000000900000009000000FFFFFFFF0000
00000000000000080000005761726E696E67730A0000000A0000000A000000FF
FFFFFF000000000000000000060000004572726F7273
000008000000556E697474657374020000000200000002000000FFFFFFFF0000
00000000000000080000005661726961626C65090000000900000009000000FF
FFFFFF000000000000000000080000005761726E696E67730A0000000A000000
0A000000FFFFFFFF000000000000000000060000004572726F7273
}
TreeLineColor = clDefault
end

View File

@ -24,6 +24,7 @@ type
_struct,
_template,
_union,
_unittest,
_variable,
_warning
);
@ -137,7 +138,7 @@ type
fSmartExpander: boolean;
ndAlias, ndClass, ndEnum, ndFunc, ndUni: TTreeNode;
ndImp, ndIntf, ndMix, ndStruct, ndTmp: TTreeNode;
ndVar, ndWarn, ndErr: TTreeNode;
ndVar, ndWarn, ndErr, ndUt: TTreeNode;
procedure TreeDblClick(Sender: TObject);
procedure actRefreshExecute(Sender: TObject);
procedure actAutoRefreshExecute(Sender: TObject);
@ -368,9 +369,10 @@ begin
ndStruct := Tree.Items[7];
ndTmp := Tree.Items[8];
ndUni := Tree.Items[9];
ndVar := Tree.Items[10];
ndWarn := Tree.Items[11];
ndErr := Tree.Items[12];
ndUt := Tree.Items[10];
ndVar := Tree.Items[11];
ndWarn := Tree.Items[12];
ndErr := Tree.Items[13];
//
png := TPortableNetworkGraphic.Create;
try
@ -565,6 +567,7 @@ begin
ndStruct.Visible:= ndStruct.Count > 0;
ndTmp.Visible := ndTmp.Count > 0;
ndUni.Visible := ndUni.Count > 0;
ndUt.Visible := ndUt.Count > 0;
ndVar.Visible := ndVar.Count > 0;
ndWarn.Visible := ndWarn.Count > 0;
ndErr.Visible := ndErr.Count > 0;
@ -580,6 +583,7 @@ begin
ndStruct.Visible:= true;
ndTmp.Visible := true;
ndUni.Visible := true;
ndUt.Visible := true;
ndVar.Visible := true;
ndWarn.Visible := true;
ndErr.Visible := true;
@ -598,6 +602,7 @@ begin
ndStruct.DeleteChildren;
ndTmp.DeleteChildren;
ndUni.DeleteChildren;
ndUt.DeleteChildren;
ndVar.DeleteChildren;
ndWarn.DeleteChildren;
ndErr.DeleteChildren;
@ -697,9 +702,10 @@ function getCatNode(node: TTreeNode; stype: TSymbolType ): TTreeNode;
_struct : begin result.ImageIndex:=7; result.SelectedIndex:=7; end;
_template : begin result.ImageIndex:=8; result.SelectedIndex:=8; end;
_union : begin result.ImageIndex:=0; result.SelectedIndex:=0; end;
_variable : begin result.ImageIndex:=1; result.SelectedIndex:=1; end;
_warning : begin result.ImageIndex:=2; result.SelectedIndex:=2; end;
_error : begin result.ImageIndex:=3; result.SelectedIndex:=3; end;
_unittest : begin result.ImageIndex:=1; result.SelectedIndex:=1; end;
_variable : begin result.ImageIndex:=2; result.SelectedIndex:=2; end;
_warning : begin result.ImageIndex:=9; result.SelectedIndex:=9; end;
_error : begin result.ImageIndex:=10; result.SelectedIndex:=10; end;
end;
end;
//
@ -716,6 +722,7 @@ begin
_struct : exit(ndStruct);
_template : exit(ndTmp);
_union : exit(ndUni);
_unittest : exit(ndUt);
_variable : exit(ndVar);
_warning : exit(ndWarn);
_error : exit(ndErr);
@ -730,6 +737,7 @@ begin
_struct: exit(newCat('Struct'));
_template: exit(newCat('Template'));
_union: exit(newCat('Union'));
_unittest: exit(newCat('Unittest'));
_variable: exit(newCat('Variable'));
_warning: exit(ndWarn);
_error: exit(ndErr);