mirror of https://gitlab.com/basile.b/dexed.git
symlist, add the 'deep' option, default = on, off = only top level decl
This commit is contained in:
parent
aa368843b5
commit
f4793e2290
|
@ -34,11 +34,13 @@ enum ListFmt
|
||||||
Json
|
Json
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__gshared bool deep;
|
||||||
|
|
||||||
void main(string[] args)
|
void main(string[] args)
|
||||||
{
|
{
|
||||||
// format
|
// format
|
||||||
bool asJson;
|
bool asJson;
|
||||||
getopt(args, std.getopt.config.passThrough, "j", &asJson);
|
getopt(args, config.passThrough, "j", &asJson, "d", &deep);
|
||||||
|
|
||||||
// get either the module from stdin or from first arg
|
// get either the module from stdin or from first arg
|
||||||
string fname;
|
string fname;
|
||||||
|
@ -73,8 +75,7 @@ void main(string[] args)
|
||||||
SymbolListBuilder!(ListFmt.Pas) slb = construct!(SymbolListBuilder!(ListFmt.Pas));
|
SymbolListBuilder!(ListFmt.Pas) slb = construct!(SymbolListBuilder!(ListFmt.Pas));
|
||||||
auto ast = parseModule(getTokensForParser(source, config, &scache), fname,
|
auto ast = parseModule(getTokensForParser(source, config, &scache), fname,
|
||||||
&alloc, &slb.astError);
|
&alloc, &slb.astError);
|
||||||
foreach (Declaration decl; ast.declarations)
|
slb.visit(ast);
|
||||||
slb.visit(decl);
|
|
||||||
write(slb.serialize);
|
write(slb.serialize);
|
||||||
slb.destruct;
|
slb.destruct;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +84,7 @@ void main(string[] args)
|
||||||
SymbolListBuilder!(ListFmt.Json) slb = construct!(SymbolListBuilder!(ListFmt.Json));
|
SymbolListBuilder!(ListFmt.Json) slb = construct!(SymbolListBuilder!(ListFmt.Json));
|
||||||
auto ast = parseModule(getTokensForParser(source, config, &scache), fname,
|
auto ast = parseModule(getTokensForParser(source, config, &scache), fname,
|
||||||
&alloc, &slb.astError);
|
&alloc, &slb.astError);
|
||||||
foreach (Declaration decl; ast.declarations)
|
slb.visit(ast);
|
||||||
slb.visit(decl);
|
|
||||||
write(slb.serialize);
|
write(slb.serialize);
|
||||||
slb.destruct;
|
slb.destruct;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
||||||
pasStream.put(format("col = %d\r", dt.name.column));
|
pasStream.put(format("col = %d\r", dt.name.column));
|
||||||
pasStream.put(format("name = '%s'\r", dt.name.text));
|
pasStream.put(format("name = '%s'\r", dt.name.text));
|
||||||
pasStream.put(format("symType = %s\r", st));
|
pasStream.put(format("symType = %s\r", st));
|
||||||
static if (dig)
|
static if (dig) if (deep)
|
||||||
{
|
{
|
||||||
pasStream.put("subs = <");
|
pasStream.put("subs = <");
|
||||||
dt.accept(this);
|
dt.accept(this);
|
||||||
|
@ -264,7 +264,7 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
||||||
item["col"] = JSONValue(dt.name.column);
|
item["col"] = JSONValue(dt.name.column);
|
||||||
item["name"] = JSONValue(dt.name.text);
|
item["name"] = JSONValue(dt.name.text);
|
||||||
item["type"] = JSONValue(to!string(st));
|
item["type"] = JSONValue(to!string(st));
|
||||||
static if (dig)
|
static if (dig) if (deep)
|
||||||
{
|
{
|
||||||
JSONValue subs = parseJSON("[]");
|
JSONValue subs = parseJSON("[]");
|
||||||
JSONValue* old = jarray;
|
JSONValue* old = jarray;
|
||||||
|
|
|
@ -84,6 +84,7 @@ type
|
||||||
fAutoExpandErrors: boolean;
|
fAutoExpandErrors: boolean;
|
||||||
fSmartExpander: boolean;
|
fSmartExpander: boolean;
|
||||||
fSortSymbols: boolean;
|
fSortSymbols: boolean;
|
||||||
|
fDeep: boolean;
|
||||||
published
|
published
|
||||||
property autoRefresh: boolean read fAutoRefresh write fAutoRefresh;
|
property autoRefresh: boolean read fAutoRefresh write fAutoRefresh;
|
||||||
property refreshOnChange: boolean read fRefreshOnChange write fRefreshOnChange;
|
property refreshOnChange: boolean read fRefreshOnChange write fRefreshOnChange;
|
||||||
|
@ -94,6 +95,7 @@ type
|
||||||
property autoExpandErrors: boolean read fAutoExpandErrors write fAutoExpandErrors;
|
property autoExpandErrors: boolean read fAutoExpandErrors write fAutoExpandErrors;
|
||||||
property sortSymbols: boolean read fSortSymbols write fSortSymbols;
|
property sortSymbols: boolean read fSortSymbols write fSortSymbols;
|
||||||
property smartExpander: boolean read fSmartExpander write fSmartExpander;
|
property smartExpander: boolean read fSmartExpander write fSmartExpander;
|
||||||
|
property deep: boolean read fDeep write fDeep default true;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
@ -131,6 +133,7 @@ type
|
||||||
fAutoRefresh: boolean;
|
fAutoRefresh: boolean;
|
||||||
fRefreshOnChange: boolean;
|
fRefreshOnChange: boolean;
|
||||||
fRefreshOnFocus: boolean;
|
fRefreshOnFocus: boolean;
|
||||||
|
fDeep: boolean;
|
||||||
fShowChildCategories: boolean;
|
fShowChildCategories: boolean;
|
||||||
fSmartFilter: boolean;
|
fSmartFilter: boolean;
|
||||||
fAutoExpandErrors: boolean;
|
fAutoExpandErrors: boolean;
|
||||||
|
@ -256,6 +259,7 @@ end;
|
||||||
constructor TCESymbolListOptions.Create(AOwner: TComponent);
|
constructor TCESymbolListOptions.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
fDeep := true;
|
||||||
fRefreshOnFocus := true;
|
fRefreshOnFocus := true;
|
||||||
fShowChildCategories := true;
|
fShowChildCategories := true;
|
||||||
fAutoExpandErrors := true;
|
fAutoExpandErrors := true;
|
||||||
|
@ -273,6 +277,7 @@ begin
|
||||||
begin
|
begin
|
||||||
widg := TCESymbolListWidget(Source);
|
widg := TCESymbolListWidget(Source);
|
||||||
//
|
//
|
||||||
|
fDeep := widg.fDeep;
|
||||||
fAutoRefreshDelay := widg.updaterByDelayDuration;
|
fAutoRefreshDelay := widg.updaterByDelayDuration;
|
||||||
fRefreshOnFocus := widg.fRefreshOnFocus;
|
fRefreshOnFocus := widg.fRefreshOnFocus;
|
||||||
fRefreshOnChange := widg.fRefreshOnChange;
|
fRefreshOnChange := widg.fRefreshOnChange;
|
||||||
|
@ -303,6 +308,7 @@ begin
|
||||||
widg.fAutoExpandErrors := fAutoExpandErrors;
|
widg.fAutoExpandErrors := fAutoExpandErrors;
|
||||||
widg.fSortSymbols := fSortSymbols;
|
widg.fSortSymbols := fSortSymbols;
|
||||||
widg.fSmartExpander := fSmartExpander;
|
widg.fSmartExpander := fSmartExpander;
|
||||||
|
widg.fDeep := fDeep;
|
||||||
//
|
//
|
||||||
widg.fActAutoRefresh.Checked := fAutoRefresh;
|
widg.fActAutoRefresh.Checked := fAutoRefresh;
|
||||||
widg.fActRefreshOnChange.Checked:= fRefreshOnChange;
|
widg.fActRefreshOnChange.Checked:= fRefreshOnChange;
|
||||||
|
@ -676,6 +682,7 @@ begin
|
||||||
fToolProc.Executable := fToolExeName;
|
fToolProc.Executable := fToolExeName;
|
||||||
fToolProc.OnTerminate := @toolTerminated;
|
fToolProc.OnTerminate := @toolTerminated;
|
||||||
fToolProc.CurrentDirectory := Application.ExeName.extractFileDir;
|
fToolProc.CurrentDirectory := Application.ExeName.extractFileDir;
|
||||||
|
if fDeep then fToolProc.Parameters.Add('-d');
|
||||||
fToolProc.Execute;
|
fToolProc.Execute;
|
||||||
str := fDoc.Text;
|
str := fDoc.Text;
|
||||||
fToolProc.Input.Write(str[1], str.length);
|
fToolProc.Input.Write(str[1], str.length);
|
||||||
|
|
Loading…
Reference in New Issue