mirror of https://gitlab.com/basile.b/dexed.git
dont fully lex the editor since only module name is interesting
This commit is contained in:
parent
b9d13630c8
commit
dacf972250
|
@ -33,6 +33,8 @@ type
|
||||||
fSyncEdit: TSynPluginSyncroEdit;
|
fSyncEdit: TSynPluginSyncroEdit;
|
||||||
tokLst: TLexTokenList;
|
tokLst: TLexTokenList;
|
||||||
errLst: TLexErrorList;
|
errLst: TLexErrorList;
|
||||||
|
fModStart: boolean;
|
||||||
|
procedure lexFindToken(const aToken: PLexToken; out doStop: boolean);
|
||||||
procedure memoKeyPress(Sender: TObject; var Key: char);
|
procedure memoKeyPress(Sender: TObject; var Key: char);
|
||||||
procedure memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
procedure memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
procedure memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
|
@ -336,6 +338,18 @@ begin
|
||||||
editorStatus.Panels[2].Text := fDoc.fileName;
|
editorStatus.Panels[2].Text := fDoc.fileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.lexFindToken(const aToken: PLexToken; out doStop: boolean);
|
||||||
|
begin
|
||||||
|
if aToken^.kind = ltkKeyword then
|
||||||
|
if aToken^.data = 'module' then
|
||||||
|
fModStart := true;
|
||||||
|
if fModStart then if aToken^.kind = ltkSymbol then
|
||||||
|
if aToken^.data = ';' then begin
|
||||||
|
doStop := true;
|
||||||
|
fModStart := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.UpdateByDelay;
|
procedure TCEEditorWidget.UpdateByDelay;
|
||||||
var
|
var
|
||||||
//dt: PMessageItemData;
|
//dt: PMessageItemData;
|
||||||
|
@ -348,31 +362,13 @@ begin
|
||||||
fKeyChanged := false;
|
fKeyChanged := false;
|
||||||
if fDoc.Lines.Count = 0 then exit;
|
if fDoc.Lines.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
|
lex(fDoc.Lines.Text, tokLst, @lexFindToken);
|
||||||
lex(fDoc.Lines.Text, tokLst);
|
|
||||||
|
|
||||||
{
|
|
||||||
if fDoc.isDSource then
|
|
||||||
begin
|
|
||||||
checkSyntacticErrors(tokLst, errLst);
|
|
||||||
for err in errLst do begin
|
|
||||||
dt := newMessageData;
|
|
||||||
dt^.editor := fDoc;
|
|
||||||
dt^.position := point(err.position.x, err.position.y);
|
|
||||||
dt^.ctxt := mcEditor;
|
|
||||||
CEMainForm.MessageWidget.addMessage(format( '%s (@line:%.4d @char:%.4d)',
|
|
||||||
[err.msg, err.position.y, err.position.x]), dt);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
|
|
||||||
md := '';
|
md := '';
|
||||||
if fDoc.isDSource then
|
if fDoc.isDSource then
|
||||||
md := getModuleName(tokLst);
|
md := getModuleName(tokLst);
|
||||||
if md = '' then md := extractFileName(fDoc.fileName);
|
if md = '' then md := extractFileName(fDoc.fileName);
|
||||||
pageControl.ActivePage.Caption := md;
|
pageControl.ActivePage.Caption := md;
|
||||||
|
//
|
||||||
//CEMainForm.MessageWidget.scrollToBack;
|
|
||||||
tokLst.Clear;
|
tokLst.Clear;
|
||||||
errLst.Clear;
|
errLst.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue