mirror of https://gitlab.com/basile.b/dexed.git
fix lexing issue with option lxoNoComments
This commit is contained in:
parent
6de74e9beb
commit
001f8d5217
|
@ -363,10 +363,13 @@ begin
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if not noComment then
|
||||||
|
begin
|
||||||
addToken(ltkComment);
|
addToken(ltkComment);
|
||||||
reader.Next;
|
|
||||||
if callBackDoStop then
|
if callBackDoStop then
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
|
reader.Next;
|
||||||
continue;
|
continue;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -390,10 +393,13 @@ begin
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if not noComment then
|
||||||
|
begin
|
||||||
addToken(ltkComment);
|
addToken(ltkComment);
|
||||||
reader.Next;
|
|
||||||
if callBackDoStop then
|
if callBackDoStop then
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
|
reader.Next;
|
||||||
continue;
|
continue;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -431,10 +437,13 @@ begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
until nestedCom = 0;
|
until nestedCom = 0;
|
||||||
|
if not noComment then
|
||||||
|
begin
|
||||||
addToken(ltkComment);
|
addToken(ltkComment);
|
||||||
reader.Next;
|
|
||||||
if callBackDoStop then
|
if callBackDoStop then
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
|
reader.Next;
|
||||||
continue;
|
continue;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -722,7 +722,7 @@ begin
|
||||||
begin
|
begin
|
||||||
if fDoc.isDSource then
|
if fDoc.isDSource then
|
||||||
begin
|
begin
|
||||||
lex(fDoc.Lines.Text, fTokList, @lexFindToken);
|
lex(fDoc.Lines.Text, fTokList, @lexFindToken, [lxoNoComments]);
|
||||||
md := getModuleName(fTokList);
|
md := getModuleName(fTokList);
|
||||||
fTokList.Clear;
|
fTokList.Clear;
|
||||||
if md.isEmpty then
|
if md.isEmpty then
|
||||||
|
|
|
@ -66,6 +66,7 @@ type
|
||||||
private
|
private
|
||||||
fProj: ICECommonProject;
|
fProj: ICECommonProject;
|
||||||
fFreeProj: ICECommonProject;
|
fFreeProj: ICECommonProject;
|
||||||
|
fModStart: boolean;
|
||||||
procedure updateButtonsState;
|
procedure updateButtonsState;
|
||||||
procedure projNew(project: ICECommonProject);
|
procedure projNew(project: ICECommonProject);
|
||||||
procedure projChanged(project: ICECommonProject);
|
procedure projChanged(project: ICECommonProject);
|
||||||
|
@ -75,6 +76,8 @@ type
|
||||||
procedure projCompiled(project: ICECommonProject; success: boolean);
|
procedure projCompiled(project: ICECommonProject; success: boolean);
|
||||||
function itemForRow(row: TListItem): TLibraryItem;
|
function itemForRow(row: TListItem): TLibraryItem;
|
||||||
procedure RowToLibrary(row: TListItem);
|
procedure RowToLibrary(row: TListItem);
|
||||||
|
function sourceRoot(project: ICECommonProject): string;
|
||||||
|
procedure lexFindToken(const token: PLexToken; out stop: boolean);
|
||||||
//
|
//
|
||||||
procedure dataToGrid;
|
procedure dataToGrid;
|
||||||
protected
|
protected
|
||||||
|
@ -84,7 +87,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// determine the root of a library, according to the module names
|
// determine the root of a library, according to the module names
|
||||||
function sourceRoot(project: ICECommonProject): string;
|
//function sourceRoot(project: ICECommonProject): string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
@ -799,10 +802,10 @@ begin
|
||||||
LibMan.updateCrossDependencies;
|
LibMan.updateCrossDependencies;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function sourceRoot(project: ICECommonProject): string;
|
function TCELibManEditorWidget.sourceRoot(project: ICECommonProject): string;
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
name: string;
|
mnme: string;
|
||||||
fold: string;
|
fold: string;
|
||||||
modn: TStringList;
|
modn: TStringList;
|
||||||
modf: TStringList;
|
modf: TStringList;
|
||||||
|
@ -814,8 +817,8 @@ begin
|
||||||
// 1 source, same folder
|
// 1 source, same folder
|
||||||
if project.sourcesCount = 1 then
|
if project.sourcesCount = 1 then
|
||||||
begin
|
begin
|
||||||
name := project.sourceAbsolute(0);
|
mnme := project.sourceAbsolute(0);
|
||||||
if name.extractFilePath = base then
|
if mnme.extractFilePath = base then
|
||||||
exit(base);
|
exit(base);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -826,11 +829,12 @@ begin
|
||||||
// get module name and store the parent.parent.parent... dir
|
// get module name and store the parent.parent.parent... dir
|
||||||
for i := 0 to project.sourcesCount-1 do
|
for i := 0 to project.sourcesCount-1 do
|
||||||
begin
|
begin
|
||||||
|
fModStart := false;
|
||||||
fold := project.sourceAbsolute(i);
|
fold := project.sourceAbsolute(i);
|
||||||
modf.LoadFromFile(fold);
|
modf.LoadFromFile(fold);
|
||||||
lex(modf.Text, toks);
|
lex(modf.Text, toks, @lexFindToken, [lxoNoComments]);
|
||||||
name := getModuleName(toks);
|
mnme := getModuleName(toks);
|
||||||
for j := 0 to WordCount(name, ['.'])-1 do
|
for j := 0 to WordCount(mnme, ['.'])-1 do
|
||||||
fold := extractFileDir(fold);
|
fold := extractFileDir(fold);
|
||||||
modn.Add(fold);
|
modn.Add(fold);
|
||||||
toks.Clear;
|
toks.Clear;
|
||||||
|
@ -860,4 +864,18 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.lexFindToken(const token: PLexToken; out stop: boolean);
|
||||||
|
begin
|
||||||
|
if (token^.kind = ltkKeyword) and (token^.data = 'module') then
|
||||||
|
begin
|
||||||
|
fModStart := true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if fModStart and (token^.kind = ltkSymbol) and (token^.data = ';') then
|
||||||
|
begin
|
||||||
|
stop := true;
|
||||||
|
fModStart := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue