MG: added perl highlighter

git-svn-id: trunk@502 -
This commit is contained in:
lazarus 2001-12-10 22:39:37 +00:00
parent fcef16c142
commit df362b22e7
8 changed files with 78 additions and 37 deletions

View File

@ -147,7 +147,7 @@ endif
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
override PACKAGE_NAME=lazarus
override PACKAGE_VERSION=0.8
override TARGET_UNITS+=syntextdrawer syneditkeycmds synedittypes syneditstrconst syneditsearch syneditmiscprocs syneditmiscclasses synedittextbuffer synedit synedithighlighter synhighlighterpas syncompletion syneditautocomplete synhighlighterhtml synhighlightercpp synhighlighterxml synhighlighterlfm
override TARGET_UNITS+=syntextdrawer syneditkeycmds synedittypes syneditstrconst syneditsearch syneditmiscprocs syneditmiscclasses synedittextbuffer synedit synedithighlighter synhighlighterpas syncompletion syneditautocomplete synhighlighterhtml synhighlightercpp synhighlighterxml synhighlighterlfm synhighlighterperl
override DIST_ZIPNAME=lazarus.synedit.$(ZIPSUFFIX)
override COMPILER_OPTIONS+=-gl
override COMPILER_UNITDIR+=$(COMPILER_UNITTARGETDIR) ../../lcl/units ../../lcl/units/$(LCLPLATFORM)

View File

@ -13,7 +13,7 @@ units=syntextdrawer syneditkeycmds synedittypes syneditstrconst \
syneditsearch syneditmiscprocs syneditmiscclasses synedittextbuffer \
synedit synedithighlighter synhighlighterpas syncompletion \
syneditautocomplete synhighlighterhtml synhighlightercpp \
synhighlighterxml synhighlighterlfm
synhighlighterxml synhighlighterlfm synhighlighterperl
[default]

View File

@ -7,18 +7,18 @@
/***************************************************************************
}
unit allunits;
unit AllUnits;
{$mode objfpc}{$H+}
interface
uses
syntextdrawer, syneditkeycmds, synedittypes, syneditstrconst,
syneditsearch, syneditmiscprocs, syneditmiscclasses, synedittextbuffer,
synedit, synedithighlighter, synhighlighterpas, syncompletion,
syneditautocomplete, synhighlighterhtml, synhighlightercpp, synhighlighterxml,
synhighlighterlfm;
SynTextDrawer, SynEditKeyCmds, SynEditTypes, SynEditStrConst,
SynEditSearch, SynEditMiscProcs, SynEditmiscClasses, SynEditTextbuffer,
SynEdit, SynEditHighlighter, SynhighlighterPas, SynCompletion,
SynEditAutoComplete, SynhighlighterHTML, SynhighlighterCPP, SynHighlighterXML,
SynHighlighterLFM, SynHighlighterPerl;
implementation
@ -27,6 +27,9 @@ end.
{ =============================================================================
$Log$
Revision 1.9 2001/12/10 22:39:37 lazarus
MG: added perl highlighter
Revision 1.8 2001/12/06 10:15:06 lazarus
MG: added xml and lfm highlighter

View File

@ -237,7 +237,8 @@ type
function GetTokenPos: Integer; override;
procedure Next; override;
procedure ResetRange; override;
procedure SetLine({$IFDEF FPC}const {$ENDIF}NewValue: string; LineNumber:Integer); override;
procedure SetLine({$IFDEF FPC}const {$ENDIF}NewValue: string;
LineNumber:Integer); override;
procedure SetRange(Value: Pointer); override;
function UseUserSettings(settingIndex: integer): boolean; override;
procedure EnumUserSettings(settings: TStrings); override;

View File

@ -8,14 +8,14 @@
Currently only for TSynEdit.
ToDo:
- Code template adding does not scroll listbox and the synedit is all white
- color schemes, key mapping schemes
- Code template adding does not scroll listbox
- key mapping schemes
- Resizing
- SetSynEditSettings
- nicer TColorButton
- create LFM file
}
unit editoroptions;
unit EditorOptions;
{$mode objfpc}{$H+}
@ -30,7 +30,7 @@ uses
{$ifdef NEW_EDITOR_SYNEDIT}
SynEdit, SynEditHighlighter, SynEditAutoComplete, SynEditKeyCmds,
SynHighlighterPas, SynHighlighterHTML, SynHighlighterCPP, SynHighlighterXML,
SynHighlighterLFM,
SynHighlighterLFM, SynHighlighterPerl,
{$else}
mwCustomEdit, mwPasSyn, mwHighlighter,
{$endif}
@ -52,7 +52,7 @@ type
TLazSyntaxHighlighter =
(lshNone, lshText, lshFreePascal, lshDelphi, lshLFM, lshXML, lshHTML,
lshCPP);
lshCPP, lshPerl);
TAdditionalHilightAttribute = (ahaNone, ahaTextBlock, ahaExecutionPoint,
ahaEnabledBreakpoint, ahaDisabledBreakpoint, ahaErrorLine);
@ -71,7 +71,7 @@ const
LazSyntaxHighlighterClasses: array[TLazSyntaxHighlighter] of TCustomSynClass =
( nil, nil, TSynPasSyn, TSynPasSyn, TSynLFMSyn, TSynXMLSyn, TSynHTMLSyn,
TSynCPPSyn);
TSynCPPSyn, TSynPerlSyn);
type
{ TEditOptLanguageInfo stores lazarus IDE additional information
@ -477,7 +477,8 @@ const
'LFM',
'XML',
'HTML',
'C++'
'C++',
'Perl'
);
var
@ -502,7 +503,7 @@ const
CompatibleLazSyntaxHilighter:
array[TLazSyntaxHighlighter] of TLazSyntaxHighlighter= (
lshNone, lshText, lshFreePascal, lshFreePascal, lshLFM, lshXML, lshHTML,
lshCPP
lshCPP, lshPerl
);
DefaultColorScheme = 'Default';
@ -847,6 +848,37 @@ begin
end;
end;
Add(NewInfo);
// create info for Perl
NewInfo:=TEditOptLanguageInfo.Create;
with NewInfo do begin
TheType:=CompatibleLazSyntaxHilighter[lshPerl];
SynClass:=LazSyntaxHighlighterClasses[TheType];
FileExtensions:='pl;pm;cgi';
SampleSource:=
'#!/usr/bin/perl'#13+
'# Perl sample code'#13+
''#13+
'$i = "10";'#13+
'print "$ENV{PATH}\n";'#13+
'($i =~ /\d+/) || die "Error\n";'#13+
''#13+
'# Text Block'#13+
''#13+
#13;
AddAttrSampleLines[ahaTextBlock]:=8;
MappedAttributes:=TStringList.Create;
with MappedAttributes do begin
Add('Comment=Comment');
Add('Identifier=Identifier');
Add('KeyAttri=Reserved_word');
Add('NumberAttri=Number');
Add('SpaceAttri=Space');
Add('StringAttri=String');
Add('Symbol=Symbol');
end;
end;
Add(NewInfo);
end;
destructor TEditOptLangList.Destroy;

View File

@ -2804,7 +2804,9 @@ writeln('[TMainIDE.DoOpenEditorFile] C');
if NewBuf<>nil then begin
LFMFilename:=ChangeFileExt(NewBuf.Filename,'.lfm');
if FileExists(LFMFilename) then
NewBuf:=CodeToolBoss.LoadFile(LFMFilename);
NewBuf:=CodeToolBoss.LoadFile(LFMFilename)
else
NewBuf:=nil;
end;
end;
@ -4962,7 +4964,7 @@ var
ActiveUnitInfo: TUnitInfo;
NewJumpPoint: TProjectJumpHistoryPosition;
begin
writeln('[TMainIDE.OnSrcNoteBookAddJumpPoint] A Line=',ACaretXY.Y,',DeleteForwardHistory=',DeleteForwardHistory,' Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
//writeln('[TMainIDE.OnSrcNoteBookAddJumpPoint] A Line=',ACaretXY.Y,',DeleteForwardHistory=',DeleteForwardHistory,' Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
ActiveUnitInfo:=Project.UnitWithEditorIndex(APageIndex);
if (ActiveUnitInfo=nil) then exit;
NewJumpPoint:=TProjectJumpHistoryPosition.Create(ActiveUnitInfo.Filename,
@ -4972,8 +4974,8 @@ writeln('[TMainIDE.OnSrcNoteBookAddJumpPoint] A Line=',ACaretXY.Y,',DeleteForwar
NewJumpPoint);
if Project.JumpHistory.HistoryIndex=Project.JumpHistory.Count-2 then
Project.JumpHistory.HistoryIndex:=Project.JumpHistory.Count-1;
writeln('[TMainIDE.OnSrcNoteBookAddJumpPoint] END Line=',ACaretXY.Y,',DeleteForwardHistory=',DeleteForwardHistory,' Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
Project.JumpHistory.WriteDebugReport;
//writeln('[TMainIDE.OnSrcNoteBookAddJumpPoint] END Line=',ACaretXY.Y,',DeleteForwardHistory=',DeleteForwardHistory,' Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
//Project.JumpHistory.WriteDebugReport;
end;
Procedure TMainIDE.OnSrcNotebookDeleteLastJumPoint(Sender: TObject);
@ -4987,7 +4989,7 @@ var DestIndex, UnitIndex, NewHistoryIndex: integer;
ActiveSrcEdit: TSourceEditor;
DestJumpPoint: TProjectJumpHistoryPosition;
begin
writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] A Back=',Action=jhaBack);
//writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] A Back=',Action=jhaBack);
{ jumping back/forward is also a jump, that's why the current source position
should be saved to the jump history before the jump.
The InsertSmart method prevents putting positions twice in the history. }
@ -4995,7 +4997,7 @@ writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] A Back=',Action=jhaBack);
// update jump history (e.g. delete jumps to closed editors)
Project.JumpHistory.DeleteInvalidPositions;
writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] B Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
//writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] B Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
DestIndex:=Project.JumpHistory.HistoryIndex;
if Action=jhaForward then begin
inc(DestIndex,2);
@ -5004,7 +5006,7 @@ writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] B Count=',Project.JumpHistor
end;
if (DestIndex<0) or (DestIndex>=Project.JumpHistory.Count) then exit;
DestJumpPoint:=Project.JumpHistory[DestIndex];
writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] C Line=',DestJumpPoint.CaretXY.Y);
//writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] C Line=',DestJumpPoint.CaretXY.Y);
NewHistoryIndex:=Project.JumpHistory.HistoryIndex;
if Action=jhaBack then begin
dec(NewHistoryIndex);
@ -5029,8 +5031,8 @@ writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] C Line=',DestJumpPoint.Caret
end;
NewPageIndex:=Project.Units[UnitIndex].EditorIndex;
end;
writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] END Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
Project.JumpHistory.WriteDebugReport;
//writeln('[TMainIDE.OnSrcNotebookJumpToHistoryPoint] END Count=',Project.JumpHistory.Count,',HistoryIndex=',Project.JumpHistory.HistoryIndex);
//Project.JumpHistory.WriteDebugReport;
end;
Procedure TMainIDE.OnSrcNotebookViewJumpHistory(Sender : TObject);
@ -5149,6 +5151,9 @@ end.
{ =============================================================================
$Log$
Revision 1.169 2001/12/10 22:39:36 lazarus
MG: added perl highlighter
Revision 1.168 2001/12/10 16:22:40 lazarus
MG: started open file at cursor

View File

@ -3,9 +3,6 @@
UnitEditor.pp
-------------------
***************************************************************************/
/***************************************************************************
@ -678,19 +675,19 @@ end;
procedure TSourceEditor.OnReplace(Sender: TObject; const ASearch, AReplace:
string; Line, Column: integer; var Action: TSynReplaceAction);
var a:integer;
ACaption,AText:AnsiString;
var a,x,y:integer;
AText:AnsiString;
begin
ACaption:='Prompt for replace';
AText:='Replace this occurrence of '''+ASearch+''' with '''+AReplace+'''?';
// a:=Application.MessageBox(PChar(AText),PChar(ACaption),MB_YESNOCANCEL);
a:=MessageDlg(ACaption,AText,mtconfirmation,[mbyes, mbno, mbcancel],0);
GetDialogPosition(300,150,X,Y);
a:=MessageDlgPos(AText,mtconfirmation,
[mbYes,mbYesToAll,mbNo,mbCancel],0,X,Y);
case a of
mrYes:Action:=raReplace;
mrNo :Action:=raSkip;
mrAll:Action:=raReplaceAll;
mrAll,mrYesToAll:Action:=raReplaceAll;
else
Action:=raCancel;
end;

View File

@ -429,8 +429,8 @@ function MessageDlgPos(const aMsg: string; DlgType: TMsgDlgType;
var
aDialog : TForm;
begin
writeln ('MessageDlgPos ****** NOT YET FULLY IMPLEMENTED ********');
aDialog := CreateMessageDialog (aMsg, DlgType, buttons);
aDialog.Position:=poDefault;
aDialog.Left := x;
aDialog.Top := y;
Result := aDialog.ShowModal;
@ -463,6 +463,9 @@ end;
{
$Log$
Revision 1.8 2001/12/10 22:39:37 lazarus
MG: added perl highlighter
Revision 1.7 2001/10/16 10:51:10 lazarus
MG: added clicked event to TButton, MessageDialog reacts to return key