diff --git a/components/synedit/Packages/delphiXE5/SynEdit.groupproj b/components/synedit/Packages/delphiXE5/SynEdit.groupproj new file mode 100644 index 00000000..be364d5e --- /dev/null +++ b/components/synedit/Packages/delphiXE5/SynEdit.groupproj @@ -0,0 +1,40 @@ + + + {d205cd7b-f0f3-443b-916b-d6bdf5e10e38} + + + + + Default.Personality + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/synedit/Packages/delphiXE5/SynEditD.dpk b/components/synedit/Packages/delphiXE5/SynEditD.dpk new file mode 100644 index 00000000..2c0608d5 --- /dev/null +++ b/components/synedit/Packages/delphiXE5/SynEditD.dpk @@ -0,0 +1,39 @@ +package SynEditD; + +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} + +requires + designide, + SynEditR; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/components/synedit/Packages/delphiXE5/SynEditD.dproj b/components/synedit/Packages/delphiXE5/SynEditD.dproj new file mode 100644 index 00000000..034da4ad --- /dev/null +++ b/components/synedit/Packages/delphiXE5/SynEditD.dproj @@ -0,0 +1,140 @@ + + + {cdf1666b-e80f-41eb-81dd-996e87fe7658} + SynEditD.dpk + Debug + DCC32 + 15.1 + Release + True + Win32 + Package + None + + + true + + + true + Base + true + + + true + Base + true + + + true + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) + ..\..\build\SynEditD.bpl + 00400000 + SynEdit component suite + true + true + true + + + ..\..\build\SynEditD.bpl + 7.0 + False + True + False + 0 + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_UnitSearchPath) + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_ResourcePath) + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_ObjPath) + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_IncludePath) + RELEASE;$(DCC_Define) + + + ..\..\build\SynEditD.bpl + 7.0 + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_UnitSearchPath) + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_ResourcePath) + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_ObjPath) + ..\..\resources;..\..\..\..\source;..\..\build;$(DCC_IncludePath) + True + True + True + True + + + Delphi.Personality.12 + Package + + + + ..\..\Source + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + SynEditD.dpk + + + + True + + + 12 + + + + MainSource + + + + + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + + diff --git a/components/synedit/Packages/delphiXE5/SynEditR.dpk b/components/synedit/Packages/delphiXE5/SynEditR.dpk new file mode 100644 index 00000000..b6a09159 --- /dev/null +++ b/components/synedit/Packages/delphiXE5/SynEditR.dpk @@ -0,0 +1,138 @@ +package SynEditR; + +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$RUNONLY} +{$IMPLICITBUILD OFF} + +requires + vcl, + vcldb, + vclx, + rtl; + +contains + SynTextDrawer in '..\..\Source\SynTextDrawer.pas', + SynAutoCorrect in '..\..\Source\SynAutoCorrect.pas', + SynAutoCorrectEditor in '..\..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, + SynCompletionProposal in '..\..\Source\SynCompletionProposal.pas', + SynDBEdit in '..\..\Source\SynDBEdit.pas', + SynEdit in '..\..\Source\SynEdit.pas', + SynEditAutoComplete in '..\..\Source\SynEditAutoComplete.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditKbdHandler in '..\..\Source\SynEditKbdHandler.pas', + SynEditKeyCmdEditor in '..\..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, + SynEditKeyCmds in '..\..\Source\SynEditKeyCmds.pas', + SynEditKeyCmdsEditor in '..\..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, + SynEditKeyConst in '..\..\Source\SynEditKeyConst.pas', + SynEditMiscClasses in '..\..\Source\SynEditMiscClasses.pas', + SynEditMiscProcs in '..\..\Source\SynEditMiscProcs.pas', + SynEditOptionsDialog in '..\..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, + SynEditPlugins in '..\..\Source\SynEditPlugins.pas', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.pas', + SynEditPrint in '..\..\Source\SynEditPrint.pas', + SynEditPrinterInfo in '..\..\Source\SynEditPrinterInfo.pas', + SynEditPrintHeaderFooter in '..\..\Source\SynEditPrintHeaderFooter.pas', + SynEditPrintMargins in '..\..\Source\SynEditPrintMargins.pas', + SynEditPrintMarginsDialog in '..\..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, + SynEditPrintPreview in '..\..\Source\SynEditPrintPreview.pas', + SynEditPrintTypes in '..\..\Source\SynEditPrintTypes.pas', + SynEditPythonBehaviour in '..\..\Source\SynEditPythonBehaviour.pas', + SynEditRegexSearch in '..\..\Source\SynEditRegexSearch.pas', + SynEditSearch in '..\..\Source\SynEditSearch.pas', + SynEditStrConst in '..\..\Source\SynEditStrConst.pas', + SynEditTextBuffer in '..\..\Source\SynEditTextBuffer.pas', + SynEditTypes in '..\..\Source\SynEditTypes.pas', + SynExportHTML in '..\..\Source\SynExportHTML.pas', + SynExportRTF in '..\..\Source\SynExportRTF.pas', + SynExportTeX in '..\..\Source\SynExportTeX.pas', + SynHighlighterADSP21xx in '..\..\Source\SynHighlighterADSP21xx.pas', + SynHighlighterAsm in '..\..\Source\SynHighlighterAsm.pas', + SynHighlighterAWK in '..\..\Source\SynHighlighterAWK.pas', + SynHighlighterBaan in '..\..\Source\SynHighlighterBaan.pas', + SynHighlighterBat in '..\..\Source\SynHighlighterBat.pas', + SynHighlighterCAC in '..\..\Source\SynHighlighterCAC.pas', + SynHighlighterCache in '..\..\Source\SynHighlighterCache.pas', + SynHighlighterCobol in '..\..\Source\SynHighlighterCobol.pas', + SynHighlighterCPM in '..\..\Source\SynHighlighterCPM.pas', + SynHighlighterCpp in '..\..\Source\SynHighlighterCpp.pas', + SynHighlighterCS in '..\..\Source\SynHighlighterCS.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGWS in '..\..\Source\SynHighlighterGWS.pas', + SynHighlighterHashEntries in '..\..\Source\SynHighlighterHashEntries.pas', + SynHighlighterHaskell in '..\..\Source\SynHighlighterHaskell.pas', + SynHighlighterHC11 in '..\..\Source\SynHighlighterHC11.pas', + SynHighlighterHP48 in '..\..\Source\SynHighlighterHP48.pas', + SynHighlighterHtml in '..\..\Source\SynHighlighterHtml.pas', + SynHighlighterIDL in '..\..\Source\SynHighlighterIDL.pas', + SynHighlighterIni in '..\..\Source\SynHighlighterIni.pas', + SynHighlighterInno in '..\..\Source\SynHighlighterInno.pas', + SynHighlighterJava in '..\..\Source\SynHighlighterJava.pas', + SynHighlighterJScript in '..\..\Source\SynHighlighterJScript.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterM3 in '..\..\Source\SynHighlighterM3.pas', + SynHighlighterModelica in '..\..\Source\SynHighlighterModelica.pas', + SynHighlighterMsg in '..\..\Source\SynHighlighterMsg.pas', + SynHighlighterMulti in '..\..\Source\SynHighlighterMulti.pas', + SynHighlighterPas in '..\..\Source\SynHighlighterPas.pas', + SynHighlighterPerl in '..\..\Source\SynHighlighterPerl.pas', + SynHighlighterPHP in '..\..\Source\SynHighlighterPHP.pas', + SynHighlighterProgress in '..\..\Source\SynHighlighterProgress.pas', + SynHighlighterPython in '..\..\Source\SynHighlighterPython.pas', + SynHighlighterRC in '..\..\Source\SynHighlighterRC.pas', + SynHighlighterRuby in '..\..\Source\SynHighlighterRuby.pas', + SynHighlighterSDD in '..\..\Source\SynHighlighterSDD.pas', + SynHighlighterSml in '..\..\Source\SynHighlighterSml.pas', + SynHighlighterSQL in '..\..\Source\SynHighlighterSQL.pas', + SynHighlighterST in '..\..\Source\SynHighlighterST.pas', + SynHighlighterTclTk in '..\..\Source\SynHighlighterTclTk.pas', + SynHighlighterTeX in '..\..\Source\SynHighlighterTeX.pas', + SynHighlighterUNIXShellScript in '..\..\Source\SynHighlighterUNIXShellScript.pas', + SynHighlighterUnreal in '..\..\Source\SynHighlighterUnreal.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.pas', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}, + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.pas'; + +end. diff --git a/components/synedit/Packages/delphiXE5/SynEditR.dproj b/components/synedit/Packages/delphiXE5/SynEditR.dproj new file mode 100644 index 00000000..eb6a8b3e --- /dev/null +++ b/components/synedit/Packages/delphiXE5/SynEditR.dproj @@ -0,0 +1,251 @@ + + + {3989c409-0738-47b7-a024-aa0e95cac986} + SynEditR.dpk + Debug + DCC32 + 15.1 + Release + True + Win32 + Package + VCL + + + true + + + true + Base + true + + + true + Base + true + + + false + true + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) + true + ..\..\build\SynEditR.bpl + 00400000 + SynEdit component suite runtime + true + true + true + + + ..\..\build\SynEditR.bpl + 7.0 + False + True + False + 0 + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\resources;..\..\..\..\source;$(DCC_UnitSearchPath) + ..\..\resources;..\..\..\..\source;$(DCC_ResourcePath) + ..\..\resources;..\..\..\..\source;$(DCC_ObjPath) + ..\..\resources;..\..\..\..\source;$(DCC_IncludePath) + RELEASE;$(DCC_Define) + + + ..\..\build\SynEditR.bpl + 7.0 + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\build + ..\..\resources;..\..\..\..\source;$(DCC_UnitSearchPath) + ..\..\resources;..\..\..\..\source;$(DCC_ResourcePath) + ..\..\resources;..\..\..\..\source;$(DCC_ObjPath) + ..\..\resources;..\..\..\..\source;$(DCC_IncludePath) + True + True + True + True + + + Delphi.Personality.12 + Package + + + + ..\..\Source + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + SynEditR.dpk + + + + True + + + 12 + + + + MainSource + + + + + + + + +
frmAutoCorrectEditor
+
+ + + + + + + + +
SynEditKeystrokeEditorForm
+
+ + +
SynEditKeystrokesEditorForm
+
+ + + + +
fmEditorOptionsDialog
+
+ + + + + + + +
SynEditPrintMarginsDlg
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + +
diff --git a/components/synedit/Source/Contributors.txt b/components/synedit/Source/Contributors.txt index aa92112d..4c9a4fce 100644 --- a/components/synedit/Source/Contributors.txt +++ b/components/synedit/Source/Contributors.txt @@ -9,7 +9,7 @@ Contributors to the SynEdit project: Mattias Gaertner, Michael Beck, Michael Hieke, Mike Gibbard, Morten J. Skovrup, Murad Kakabayev, Pieter Polak, Primoz Gabrijelcic, Roman Silin, Ruggero Bandera, Satya, Stefan van As, Steve Sutherland, - Sven Blankenberg, Tony De Buys, Woo Young Bum + Sven Blankenberg, Tony De Buys, Woo Young Bum, Roman Kassebaum Most of the files in the SynEdit package are based on mwEdit version 0.92a. diff --git a/components/synedit/Source/SynCompletionProposal.pas b/components/synedit/Source/SynCompletionProposal.pas index 392d0f49..bcefcd0b 100644 --- a/components/synedit/Source/SynCompletionProposal.pas +++ b/components/synedit/Source/SynCompletionProposal.pas @@ -29,11 +29,15 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynCompletionProposal.pas,v 1.73.2.11 2008/09/17 13:59:11 maelh Exp $ +$Id: SynCompletionProposal.pas,v 1.80.1.1 2013/06/25 10:31:19 codehunterworks Exp $ You may retrieve the latest version of this file at the SynEdit home page, located at http://SynEdit.SourceForge.net +Last Changes: + 1.80.1.1 - Removed TProposalColumn.BiggestWord and + added TProposalColumn.ColumnWidth (Static Column Width in Pixels) + Known Issues: -------------------------------------------------------------------------------} @@ -537,20 +541,19 @@ type property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; end; - TProposalColumn = class(TCollectionItem) private - FBiggestWord: UnicodeString; + FColumnWidth: Integer; FInternalWidth: Integer; FFontStyle: TFontStyles; protected - procedure DefineProperties(Filer: TFiler); override; + procedure DefineProperties(Filer: TFiler); override; public constructor Create(Collection: TCollection); override; destructor Destroy; override; procedure Assign(Source: TPersistent); override; published - property BiggestWord: UnicodeString read FBiggestWord write FBiggestWord; + property ColumnWidth: Integer read FColumnWidth write FColumnWidth; property DefaultFontStyle: TFontStyles read FFontStyle write FFontStyle default []; end; @@ -982,7 +985,7 @@ begin begin if CurrentColumnIndex <= Columns.Count -1 then begin - inc(LastColumnStart, TextWidth(TargetCanvas, CurrentColumn.FBiggestWord+' ')); + inc(LastColumnStart, CurrentColumn.FColumnWidth); X := LastColumnStart; inc(CurrentColumnIndex); @@ -1116,7 +1119,7 @@ end; constructor TProposalColumn.Create(Collection: TCollection); begin inherited; - FBiggestWord := 'CONSTRUCTOR'; + FColumnWidth := 100; FInternalWidth := -1; FFontStyle := []; end; @@ -1130,7 +1133,7 @@ procedure TProposalColumn.Assign(Source: TPersistent); begin if Source is TProposalColumn then begin - FBiggestWord := TProposalColumn(Source).FBiggestWord; + FColumnWidth := TProposalColumn(Source).FColumnWidth; FInternalWidth := TProposalColumn(Source).FInternalWidth; FFontStyle := TProposalColumn(Source).FFontStyle; end @@ -1518,7 +1521,7 @@ begin {$ENDIF} end; -{$MESSAGE 'Check what must be adapted in DoKeyPressW and related methods'} +{.$MESSAGE 'Check what must be adapted in DoKeyPressW and related methods'} procedure TSynBaseCompletionProposalForm.DoKeyPressW(Key: WideChar); begin if Key <> #0 then @@ -3757,9 +3760,9 @@ begin FInternalCompletion.EndOfTokenChr := FEndOfTokenChr; FInternalCompletion.ShortCut := 0; FInternalCompletion.OnAfterCodeCompletion := DoInternalAutoCompletion; - with FInternalCompletion.Columns.Add do - //this is the trigger column - BiggestWord := 'XXXXXXXX'; +// with FInternalCompletion.Columns.Add do +// //this is the trigger column +// BiggestWord := 'XXXXXXXX'; end; function TSynAutoComplete.GetOptions: TSynCompletionOptions; diff --git a/components/synedit/Source/SynEdit.inc b/components/synedit/Source/SynEdit.inc index c43fb1e1..de3e076a 100644 --- a/components/synedit/Source/SynEdit.inc +++ b/components/synedit/Source/SynEdit.inc @@ -50,6 +50,12 @@ (* SYN_COMPILER_15_UP : Delphi XE or higher is the compiler. *) (* SYN_COMPILER_16 : Delphi XE2 is the compiler. *) (* SYN_COMPILER_16_UP : Delphi XE2 or higher is the compiler. *) +(* SYN_COMPILER_17 : Delphi XE3 is the compiler. *) +(* SYN_COMPILER_17_UP : Delphi XE3 or higher is the compiler. *) +(* SYN_COMPILER_18 : Delphi XE4 is the compiler. *) +(* SYN_COMPILER_18_UP : Delphi XE4 or higher is the compiler. *) +(* SYN_COMPILER_19 : Delphi XE5 is the compiler. *) +(* SYN_COMPILER_19_UP : Delphi XE5 or higher is the compiler. *) (* SYN_CPPB : Any version of C++Builder is being used. *) (* SYN_CPPB_1 : C++B v1.0x is being used. *) (* SYN_CPPB_3 : C++B v3.0x is being used. *) @@ -90,6 +96,12 @@ (* SYN_DELPHI_XE_UP : Delphi XE or higher is being used. *) (* SYN_DELPHI_XE2 : Delphi XE2 is being used. *) (* SYN_DELPHI_XE2_UP : Delphi XE2 or higher is being used. *) +(* SYN_DELPHI_XE3 : Delphi XE3 is being used. *) +(* SYN_DELPHI_XE3_UP : Delphi XE3 or higher is being used. *) +(* SYN_DELPHI_XE4 : Delphi XE4 is being used. *) +(* SYN_DELPHI_XE4_UP : Delphi XE4 or higher is being used. *) +(* SYN_DELPHI_XE5 : Delphi XE5 is being used. *) +(* SYN_DELPHI_XE5_UP : Delphi XE5 or higher is being used. *) (* SYN_KYLIX : Kylix 1.0 is being using. *) (* SYN_CLX : A CLX application is being created. *) (******************************************************************************) @@ -114,7 +126,7 @@ { with other versions of jedi.inc in the search-path. } {------------------------------------------------------------------------------} -{.$I jedi.inc} +{.$I SynEditJedi.inc} {------------------------------------------------------------------------------} { SYN_WIN32, SYN_LINUX and SYN_KYLIX defines } @@ -136,6 +148,24 @@ { VERXXX to SYN_COMPILERX, SYN_DELPHIX and SYN_CPPBX mappings } {------------------------------------------------------------------------------} +{$IFDEF VER260} + {$DEFINE SYN_COMPILER_19} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE5} +{$ENDIF} + +{$IFDEF VER250} + {$DEFINE SYN_COMPILER_18} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE4} +{$ENDIF} + +{$IFDEF VER240} + {$DEFINE SYN_COMPILER_17} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE3} +{$ENDIF} + {$IFDEF VER230} {$DEFINE SYN_COMPILER_16} {$DEFINE SYN_DELPHI} @@ -414,6 +444,66 @@ {$DEFINE SYN_COMPILER_16_UP} {$ENDIF} +{$IFDEF SYN_COMPILER_17} + {$DEFINE SYN_COMPILER_1_UP} + {$DEFINE SYN_COMPILER_2_UP} + {$DEFINE SYN_COMPILER_3_UP} + {$DEFINE SYN_COMPILER_4_UP} + {$DEFINE SYN_COMPILER_5_UP} + {$DEFINE SYN_COMPILER_6_UP} + {$DEFINE SYN_COMPILER_7_UP} + {$DEFINE SYN_COMPILER_8_UP} + {$DEFINE SYN_COMPILER_9_UP} + {$DEFINE SYN_COMPILER_10_UP} + {$DEFINE SYN_COMPILER_11_UP} + {$DEFINE SYN_COMPILER_12_UP} + {$DEFINE SYN_COMPILER_14_UP} + {$DEFINE SYN_COMPILER_15_UP} + {$DEFINE SYN_COMPILER_16_UP} + {$DEFINE SYN_COMPILER_17_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_18} + {$DEFINE SYN_COMPILER_1_UP} + {$DEFINE SYN_COMPILER_2_UP} + {$DEFINE SYN_COMPILER_3_UP} + {$DEFINE SYN_COMPILER_4_UP} + {$DEFINE SYN_COMPILER_5_UP} + {$DEFINE SYN_COMPILER_6_UP} + {$DEFINE SYN_COMPILER_7_UP} + {$DEFINE SYN_COMPILER_8_UP} + {$DEFINE SYN_COMPILER_9_UP} + {$DEFINE SYN_COMPILER_10_UP} + {$DEFINE SYN_COMPILER_11_UP} + {$DEFINE SYN_COMPILER_12_UP} + {$DEFINE SYN_COMPILER_14_UP} + {$DEFINE SYN_COMPILER_15_UP} + {$DEFINE SYN_COMPILER_16_UP} + {$DEFINE SYN_COMPILER_17_UP} + {$DEFINE SYN_COMPILER_18_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_19} + {$DEFINE SYN_COMPILER_1_UP} + {$DEFINE SYN_COMPILER_2_UP} + {$DEFINE SYN_COMPILER_3_UP} + {$DEFINE SYN_COMPILER_4_UP} + {$DEFINE SYN_COMPILER_5_UP} + {$DEFINE SYN_COMPILER_6_UP} + {$DEFINE SYN_COMPILER_7_UP} + {$DEFINE SYN_COMPILER_8_UP} + {$DEFINE SYN_COMPILER_9_UP} + {$DEFINE SYN_COMPILER_10_UP} + {$DEFINE SYN_COMPILER_11_UP} + {$DEFINE SYN_COMPILER_12_UP} + {$DEFINE SYN_COMPILER_14_UP} + {$DEFINE SYN_COMPILER_15_UP} + {$DEFINE SYN_COMPILER_16_UP} + {$DEFINE SYN_COMPILER_17_UP} + {$DEFINE SYN_COMPILER_18_UP} + {$DEFINE SYN_COMPILER_19_UP} +{$ENDIF} + {$IFDEF SYN_DELPHI_2} {$DEFINE SYN_DELPHI_2_UP} {$ENDIF} @@ -561,6 +651,63 @@ {$DEFINE SYN_DELPHI_XE2_UP} {$ENDIF} +{$IFDEF SYN_DELPHI_XE3} + {$DEFINE SYN_DELPHI_2_UP} + {$DEFINE SYN_DELPHI_3_UP} + {$DEFINE SYN_DELPHI_4_UP} + {$DEFINE SYN_DELPHI_5_UP} + {$DEFINE SYN_DELPHI_6_UP} + {$DEFINE SYN_DELPHI_7_UP} + {$DEFINE SYN_DELPHI_8_UP} + {$DEFINE SYN_DELPHI_2005_UP} + {$DEFINE SYN_DELPHI_2006_UP} + {$DEFINE SYN_DELPHI_2007_UP} + {$DEFINE SYN_DELPHI_2009_UP} + {$DEFINE SYN_DELPHI_2010_UP} + {$DEFINE SYN_DELPHI_XE_UP} + {$DEFINE SYN_DELPHI_XE2_UP} + {$DEFINE SYN_DELPHI_XE3_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_XE4} + {$DEFINE SYN_DELPHI_2_UP} + {$DEFINE SYN_DELPHI_3_UP} + {$DEFINE SYN_DELPHI_4_UP} + {$DEFINE SYN_DELPHI_5_UP} + {$DEFINE SYN_DELPHI_6_UP} + {$DEFINE SYN_DELPHI_7_UP} + {$DEFINE SYN_DELPHI_8_UP} + {$DEFINE SYN_DELPHI_2005_UP} + {$DEFINE SYN_DELPHI_2006_UP} + {$DEFINE SYN_DELPHI_2007_UP} + {$DEFINE SYN_DELPHI_2009_UP} + {$DEFINE SYN_DELPHI_2010_UP} + {$DEFINE SYN_DELPHI_XE_UP} + {$DEFINE SYN_DELPHI_XE2_UP} + {$DEFINE SYN_DELPHI_XE3_UP} + {$DEFINE SYN_DELPHI_XE4_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_XE5} + {$DEFINE SYN_DELPHI_2_UP} + {$DEFINE SYN_DELPHI_3_UP} + {$DEFINE SYN_DELPHI_4_UP} + {$DEFINE SYN_DELPHI_5_UP} + {$DEFINE SYN_DELPHI_6_UP} + {$DEFINE SYN_DELPHI_7_UP} + {$DEFINE SYN_DELPHI_8_UP} + {$DEFINE SYN_DELPHI_2005_UP} + {$DEFINE SYN_DELPHI_2006_UP} + {$DEFINE SYN_DELPHI_2007_UP} + {$DEFINE SYN_DELPHI_2009_UP} + {$DEFINE SYN_DELPHI_2010_UP} + {$DEFINE SYN_DELPHI_XE_UP} + {$DEFINE SYN_DELPHI_XE2_UP} + {$DEFINE SYN_DELPHI_XE3_UP} + {$DEFINE SYN_DELPHI_XE4_UP} + {$DEFINE SYN_DELPHI_XE5_UP} +{$ENDIF} + {$IFDEF SYN_CPPB_6} {$DEFINE SYN_CPPB_3_UP} {$DEFINE SYN_CPPB_4_UP} diff --git a/components/synedit/Source/SynEdit.pas b/components/synedit/Source/SynEdit.pas index 72a314ef..1b7ce94f 100644 --- a/components/synedit/Source/SynEdit.pas +++ b/components/synedit/Source/SynEdit.pas @@ -82,6 +82,9 @@ uses {$IFDEF SYN_COMPILER_7} Themes, {$ENDIF} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} SynUnicode, {$ENDIF} {$IFDEF SYN_CLX} @@ -1144,6 +1147,9 @@ uses {$IFDEF SYN_COMPILER_6_UP} Consts, {$ENDIF} +{$IFDEF SYN_COMPILER_18_UP} + AnsiStrings, +{$ENDIF} {$IFDEF SYN_CLX} QStdActns, QClipbrd, @@ -4827,7 +4833,7 @@ begin if Visible then SendMessage(Handle, WM_SETREDRAW, 0, 0); - if (fScrollBars in [ssBoth, ssHorizontal]) and not WordWrap then + if (fScrollBars in [{$IFDEF SYN_COMPILER_17_UP}TScrollStyle.{$ENDIF}ssBoth, {$IFDEF SYN_COMPILER_17_UP}TScrollStyle.{$ENDIF}ssHorizontal]) and not WordWrap then begin if eoScrollPastEol in Options then nMaxScroll := MaxScrollWidth @@ -5163,8 +5169,8 @@ begin end else begin - StrLCopy(PAnsiChar(Msg.Text), PAnsiChar(AnsiString(Text)), Msg.TextMax - 1); - Msg.Result := StrLen(PAnsiChar(Msg.Text)); + {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(PAnsiChar(Msg.Text), PAnsiChar(AnsiString(Text)), Msg.TextMax - 1); + Msg.Result := {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLen(PAnsiChar(Msg.Text)); end; end; diff --git a/components/synedit/Source/jedi.inc b/components/synedit/Source/SynEditJedi.inc similarity index 97% rename from components/synedit/Source/jedi.inc rename to components/synedit/Source/SynEditJedi.inc index b7105e8e..d361ffc8 100644 --- a/components/synedit/Source/jedi.inc +++ b/components/synedit/Source/SynEditJedi.inc @@ -39,7 +39,7 @@ { } {**************************************************************************************************} { } -{ Last modified: $Date: 2008/09/17 13:59:12 $ } +{ Last modified: $Date: 2009/01/06 16:26:01 $ } { Revision: $Rev:: 2446 $ } { Author: $Author: maelh $ } { } diff --git a/components/synedit/Source/SynHighlighterCss.pas b/components/synedit/Source/SynHighlighterCss.pas index b3cb2228..6809e7b1 100644 --- a/components/synedit/Source/SynHighlighterCss.pas +++ b/components/synedit/Source/SynHighlighterCss.pas @@ -77,8 +77,8 @@ uses Classes; type - TtkTokenKind = (tkComment, tkProperty, tkKey, tkNull, - tkSpace, tkString, tkSymbol, tkText, tkUndefProperty, tkValue, tkColor, tkNumber); + TtkTokenKind = (tkComment, tkProperty, tkKey, tkNull, tkSpace, tkString, + tkSymbol, tkText, tkUndefProperty, tkValue, tkColor, tkNumber, tkImportant); TRangeState = (rsComment, rsKey, rsParam, rsText, rsUnKnown, rsValue); @@ -98,6 +98,7 @@ type fTextAttri: TSynHighlighterAttributes; fValueAttri: TSynHighlighterAttributes; fUndefPropertyAttri: TSynHighlighterAttributes; + fImportantPropertyAttri: TSynHighlighterAttributes; fKeywords: TSynHashEntryList; procedure DoAddKeyword(AKeyword: UnicodeString; AKind: integer); function HashKey(Str: PWideChar): Integer; @@ -117,6 +118,7 @@ type procedure StringProc; procedure HashProc; procedure SlashProc; + procedure ExclamProc; protected function GetSampleSource: UnicodeString; override; function IsFilterStored: Boolean; override; @@ -159,6 +161,8 @@ type write fValueAttri; property UndefPropertyAttri: TSynHighlighterAttributes read fUndefPropertyAttri write fUndefPropertyAttri; + property ImportantPropertyAttri: TSynHighlighterAttributes read fImportantPropertyAttri + write fImportantPropertyAttri; end; implementation @@ -521,6 +525,12 @@ begin fUndefPropertyAttri.Foreground := $00ff0080; AddAttribute(fUndefPropertyAttri); + fImportantPropertyAttri := TSynHighlighterAttributes.Create( + 'Important', 'Important Marker'); + fImportantPropertyAttri.Style := [fsBold]; + fImportantPropertyAttri.Foreground := clRed; + AddAttribute(fImportantPropertyAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); AddAttribute(fSpaceAttri); @@ -645,14 +655,16 @@ begin end; rsValue: begin - fRange := rsParam; fTokenID := tkValue; while not IsLineEnd(Run) and - not CharInSet(fLine[Run], ['}', ';', ',']) do + not CharInSet(fLine[Run], ['}', ';', ',', ' ']) do begin Inc(Run); end; + + if IsLineEnd(Run) or CharInSet(fLine[Run], ['}', ';']) then + fRange := rsParam; end; else fTokenID := IdentKind((fLine + Run)); @@ -730,6 +742,25 @@ begin while IsHexChar do Inc(Run); end; +procedure TSynCssSyn.ExclamProc; +begin + if (fLine[Run + 1] = 'i') and + (fLine[Run + 2] = 'm') and + (fLine[Run + 3] = 'p') and + (fLine[Run + 4] = 'o') and + (fLine[Run + 5] = 'r') and + (fLine[Run + 6] = 't') and + (fLine[Run + 7] = 'a') and + (fLine[Run + 8] = 'n') and + (fLine[Run + 9] = 't') then + begin + fTokenID := tkImportant; + Inc(Run, 10); + end + else + IdentProc; +end; + procedure TSynCssSyn.SlashProc; begin inc(Run); @@ -775,6 +806,7 @@ begin ';': SemiProc; '0'..'9', '-', '.': NumberProc; '/': SlashProc; + '!': ExclamProc; else IdentProc; end; end; @@ -811,6 +843,7 @@ begin tkSymbol: Result := fSymbolAttri; tkText: Result := fTextAttri; tkUndefProperty: Result := fUndefPropertyAttri; + tkImportant: Result := fImportantPropertyAttri; tkValue: Result := fValueAttri; tkColor: Result := fColorAttri; tkNumber: Result := fNumberAttri; diff --git a/components/synedit/Source/SynHighlighterDWS.pas b/components/synedit/Source/SynHighlighterDWS.pas index af4434f1..06c95737 100644 --- a/components/synedit/Source/SynHighlighterDWS.pas +++ b/components/synedit/Source/SynHighlighterDWS.pas @@ -148,6 +148,12 @@ type procedure SetRange(Value: Pointer); override; function IsIdentChar(AChar: WideChar): Boolean; override; + procedure LoadDelphiStyle; virtual; + // ^^^ + // This routine can be called to install a Delphi style of colors + // and highlighting. It modifies the basic TSynDWSSyn to reproduce + // the most recent Delphi editor highlighting. + published property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri; property CommentAttri: TSynHighlighterAttributes read fCommentAttri @@ -180,7 +186,7 @@ uses const // if the language is case-insensitive keywords *must* be in lowercase - cKeyWords: array[1..96] of UnicodeString = ( + cKeyWords: array[1..95] of UnicodeString = ( 'abstract', 'and', 'array', 'as', 'asm', 'begin', 'break', 'case', 'cdecl', 'class', 'const', 'constructor', 'contains', 'continue', 'deprecated', 'destructor', @@ -196,7 +202,7 @@ const 'register', 'reintroduce', 'repeat', 'require', 'resourcestring', 'sar', 'sealed', 'set', 'shl', 'shr', 'static', 'step', 'then', 'to', 'try', 'type', 'unit', 'until', - 'uses', 'var', 'virtual', 'while', 'xor', 'if' + 'uses', 'var', 'virtual', 'while', 'xor' ); cKeyWords_PropertyScoped: array [0..4] of UnicodeString = ( 'default', 'index', 'read', 'stored', 'write' @@ -211,16 +217,16 @@ function TSynDWSSyn.HashKey(Str: PWideChar): Cardinal; var c : Word; begin - Result := 0; + Result:=0; while IsIdentChar(Str^) do begin - c := Ord(Str^); - Result := Result * 812 + c * 76; + c:=Ord(Str^); if c in [Ord('A')..Ord('Z')] then - Result := Result + (Ord('a') - Ord('A')) * 76; + c := c + (Ord('a')-Ord('A')); + Result := Result * 692 + c * 171; inc(Str); end; - Result := Result mod 389; fStringLen := Str - fToIdent; + Result := Result mod Cardinal(Length(fIdentFuncTable)); end; function TSynDWSSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; @@ -236,16 +242,22 @@ begin end; procedure TSynDWSSyn.InitIdent; + + procedure SetIdentFunc(h : Integer; const func : TIdentFuncTableFunc); + begin + fIdentFuncTable[h]:=func; + end; + var - i: Integer; + i : Integer; begin for i:=Low(cKeyWords) to High(cKeyWords) do begin - fIdentFuncTable[HashKey(@cKeyWords[i][1])]:=KeyWordFunc; + SetIdentFunc(HashKey(@cKeyWords[i][1]), KeyWordFunc); fKeyWords.Add(cKeyWords[i]); end; for i:=0 to High(cKeyWords_PropertyScoped) do begin - fIdentFuncTable[HashKey(@cKeyWords_PropertyScoped[i][1])]:=FuncPropertyScoped; + SetIdentFunc(HashKey(@cKeyWords_PropertyScoped[i][1]), FuncPropertyScoped); fKeyWords_PropertyScoped.Add(cKeyWords_PropertyScoped[i]); end; @@ -253,10 +265,9 @@ begin if @fIdentFuncTable[i] = nil then fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[HashKey('asm')] := FuncAsm; - fIdentFuncTable[HashKey('end')] := FuncEnd; - fIdentFuncTable[HashKey('property')] := FuncProperty; + SetIdentFunc(HashKey('asm'), FuncAsm); + SetIdentFunc(HashKey('end'), FuncEnd); + SetIdentFunc(HashKey('property'), FuncProperty); fKeyWords.Sorted:=True; end; @@ -271,7 +282,7 @@ var buf : String; begin SetString(buf, fToIdent, fStringLen); - if (fKeyWords.IndexOf(buf)>0) and (FLine[Run - 1] <> '&') then + if (fKeyWords.IndexOf(buf)>=0) and (FLine[Run - 1] <> '&') then Result := tkKey else Result := tkIdentifier end; @@ -300,7 +311,7 @@ var buf : String; begin SetString(buf, fToIdent, fStringLen); - if (fRange = rsProperty) and (fKeyWords_PropertyScoped.IndexOf(buf)>0) then + if (fRange = rsProperty) and (fKeyWords_PropertyScoped.IndexOf(buf)>=0) then Result:=tkKey else Result:=KeyWordFunc; end; @@ -510,6 +521,56 @@ begin inc(Run); end; +procedure TSynDWSSyn.LoadDelphiStyle; + + + procedure AddKeyword( const AName : string ); + var + I : integer; + begin + I := HashKey( @AName[1] ); + fIdentFuncTable[I]:= KeyWordFunc; + fKeyWords.Add(AName); + end; + + procedure RemoveKeyword( const AName : string ); + var + I : integer; + begin + I := fKeyWords.IndexOf(AName); + if I <> -1 then + fKeywords.Delete( I ); + end; + +const + clID = clNavy; + clString = clBlue; + clComment = clGreen; + cKeywordsToAdd: array[0..0] of UnicodeString = ( + 'string'); + cKeywordsToRemove: array[0..1] of UnicodeString = ( + 'break', 'exit'); +var + i : integer; +begin + // This routine can be called to install a Delphi style of colors + // and highlighting. It modifies the basic TSynDWSSyn to reproduce + // the most recent Delphi editor highlighting. + + // Delphi colors... + KeyAttri.Foreground := clID; + StringAttri.Foreground := clString; + CommentAttri.Foreground := clComment; + + // These are keywords highlighted in Delphi but not in TSynDWSSyn .. + for i:=Low(cKeywordsToAdd) to High(cKeywordsToAdd) do + AddKeyword( cKeywordsToAdd[i] ); + + // These are keywords highlighted in TSynDWSSyn but not in Delphi... + for i:=Low(cKeywordsToRemove) to High(cKeywordsToRemove) do + RemoveKeyword( cKeywordsToRemove[i] ); +end; + procedure TSynDWSSyn.LowerProc; begin fTokenID := tkSymbol; @@ -759,7 +820,7 @@ begin end; end; #$0080..#$FFFF : - if TCharacter.IsLetterOrDigit(fLine[Run]) then + if {$IFDEF SYN_COMPILER_18_UP}Char(fLine[Run]).IsLetterOrDigit{$ELSE}TCharacter.IsLetterOrDigit(fLine[Run]){$ENDIF} then IdentProc else UnknownProc; else @@ -908,8 +969,9 @@ end; function TSynDWSSyn.IsIdentChar(AChar: WideChar): Boolean; begin if Ord(AChar)<=$7F then - Result:=AnsiChar(AChar) in ['_', '0'..'9', 'A'..'Z', 'a'..'z'] - else Result:=TCharacter.IsLetterOrDigit(AChar); + Result := AnsiChar(AChar) in ['_', '0'..'9', 'A'..'Z', 'a'..'z'] + else + Result := {$IFDEF SYN_COMPILER_18_UP}AChar.IsLetterOrDigit{$ELSE}TCharacter.IsLetterOrDigit(AChar){$ENDIF}; end; class function TSynDWSSyn.GetFriendlyLanguageName: UnicodeString; diff --git a/components/synedit/Source/SynHighlighterLLVM.pas b/components/synedit/Source/SynHighlighterLLVM.pas new file mode 100644 index 00000000..83b4954e --- /dev/null +++ b/components/synedit/Source/SynHighlighterLLVM.pas @@ -0,0 +1,1117 @@ +{------------------------------------------------------------------------------- +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for +the specific language governing rights and limitations under the License. + +Code template generated with SynGen. +The original code is: C:\Users\Public\Code\SynEdit\SynGen\LLVM_IR.pas, released 2013-03-30. +Description: Syntax Parser/Highlighter +The initial author of this file is Christian. +Copyright (c) 2013, all rights reserved. + +Contributors to the SynEdit and mwEdit projects are listed in the +Contributors.txt file. + +Alternatively, the contents of this file may be used under the terms of the +GNU General Public License Version 2 or later (the "GPL"), in which case +the provisions of the GPL are applicable instead of those above. +If you wish to allow use of your version of this file only under the terms +of the GPL and not to allow others to use your version of this file +under the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the GPL. +If you do not delete the provisions above, a recipient may use your version +of this file under either the MPL or the GPL. + +$Id: $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +{$IFNDEF QLLVM_IR} +unit SynHighlighterLLVM; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses +{$IFDEF SYN_CLX} + QGraphics, + QSynEditTypes, + QSynEditHighlighter, + QSynUnicode, +{$ELSE} + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, +{$ENDIF} + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkBoolean, + tkComment, + tkConstant, + tkFloat, + tkHex, + tkIdentifier, + tkInstruction, + tkKey, + tkLabel, + tkNumber, + tkNull, + tkSpace, + tkString, + tkSymbol, + tkType, + tkUnnamedIdentifier, + tkUnknown); + + TRangeState = (rsUnKnown, rsSingleComment, rsString); + + TProcTableProc = procedure of object; + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynLLVMIRSyn = class(TSynCustomHighlighter) + private + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..1552] of TIdentFuncTableFunc; + fBooleanAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fConstantAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fInstructionAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fLabelAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fTypesAttri: TSynHighlighterAttributes; + function HashKey(Str: PWideChar): Cardinal; + function FuncBoolean(Index: Integer): TtkTokenKind; + function FuncConstant(Index: Integer): TtkTokenKind; + function FuncInstruction(Index: Integer): TtkTokenKind; + function FuncKey(Index: Integer): TtkTokenKind; + function FuncType(Index: Integer): TtkTokenKind; + procedure IdentProc; + procedure UnknownProc; + function AltFunc(Index: Integer): TtkTokenKind; + procedure InitIdent; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure NullProc; + procedure SpaceProc; + procedure CRProc; + procedure LFProc; + procedure IntegerTypeProc; + procedure SingleCommentOpenProc; + procedure SingleCommentProc; + procedure StringOpenProc; + procedure StringProc; + procedure AtTypeProc; + procedure PercentTypeProc; + procedure NumberProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + constructor Create(AOwner: TComponent); override; + class function GetFriendlyLanguageName: UnicodeString; override; + class function GetLanguageName: string; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; + function GetEol: Boolean; override; + function GetKeyWords(TokenKind: Integer): UnicodeString; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property BooleanAttribute: TSynHighlighterAttributes read fBooleanAttri write fBooleanAttri; + property CommentAttribute: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property ConstantAttribute: TSynHighlighterAttributes read fConstantAttri write fConstantAttri; + property IdentifierAttribute: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property InstructionAttribute: TSynHighlighterAttributes read fInstructionAttri write fInstructionAttri; + property KeywordAttribute: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property LabelAttribute: TSynHighlighterAttributes read fLabelAttri write fLabelAttri; + property NumberAttribute: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property SpaceAttribute: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttribute: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property TypesAttribute: TSynHighlighterAttributes read fTypesAttri write fTypesAttri; + end; + +implementation + +uses +{$IFDEF SYN_CLX} + QSynEditStrConst; +{$ELSE} + SynEditStrConst; +{$ENDIF} + +resourcestring + SYNS_FilterLLVMIR = 'LLVM IR files (*.ll)|*.ll'; + SYNS_LangLLVMIR = 'LLVM IR'; + SYNS_FriendlyLangLLVMIR = 'LLVM Intermediate Representation'; + SYNS_AttrConstant = 'Constant'; + SYNS_FriendlyAttrConstant = 'Constant'; + SYNS_AttrInstructions = 'Instructions'; + SYNS_FriendlyAttrInstructions = 'Instructions'; + +const + // as this language is case-insensitive keywords *must* be in lowercase + KeyWords: array[0..216] of UnicodeString = ( + 'acq_rel', 'acquire', 'add', 'addrspace', 'alias', 'align', 'alignstack', + 'alloca', 'alwaysinline', 'and', 'appending', 'arcp', 'arm_aapcs_vfpcc', + 'arm_aapcscc', 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw', + 'available_externally', 'bitcast', 'blockaddress', 'br', 'byval', 'c', + 'call', 'catch', 'cc', 'ccc', 'cleanup', 'cmpxchg', 'coldcc', 'common', + 'constant', 'datalayout', 'declare', 'default', 'define', 'deplibs', + 'dllexport', 'dllimport', 'double', 'eq', 'exact', 'except', 'extern_weak', + 'external', 'extractelement', 'extractvalue', 'fadd', 'false', 'fast', + 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'float', 'fmul', 'fp128', + 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'free', 'frem', 'fsub', 'gc', + 'getelementptr', 'global', 'half', 'hidden', 'icmp', 'inbounds', + 'indirectbr', 'initialexec', 'inlinehint', 'inreg', 'insertelement', + 'insertvalue', 'intel_ocl_bicc', 'inteldialect', 'internal', 'inttoptr', + 'invoke', 'label', 'landingpad', 'linker_private', 'linker_private_weak', + 'linker_private_weak_def_auto', 'linkonce', 'linkonce_odr', + 'linkonce_odr_auto_hide', 'load', 'localdynamic', 'localexec', 'lshr', + 'malloc', 'max', 'metadata', 'min', 'minsize', 'module', 'monotonic', + 'msp430_intrcc', 'mul', 'naked', 'nand', 'ne', 'nest', 'ninf', 'nnan', + 'noalias', 'nocapture', 'noimplicitfloat', 'noinline', 'nonlazybind', + 'noredzone', 'noreturn', 'nounwind', 'nsw', 'nsz', 'null', 'nuw', 'oeq', + 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optsize', 'or', 'ord', + 'personality', 'phi', 'ppc_fp128', 'private', 'protected', 'ptrtoint', + 'ptx_device', 'ptx_kernel', 'readnone', 'readonly', 'release', 'resume', + 'ret', 'returns_twice', 'sanitize_address', 'sanitize_memory', + 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst', 'sext', 'sge', + 'sgt', 'shl', 'shufflevector', 'sideeffect', 'signext', 'singlethread', + 'sitofp', 'sle', 'slt', 'spir_func', 'spir_kernel', 'srem', 'sret', 'ssp', + 'sspreq', 'sspstrong', 'store', 'sub', 'switch', 'tail', 'target', + 'thread_local', 'to', 'triple', 'true', 'trunc', 'type', 'udiv', 'ueq', + 'uge', 'ugt', 'uitofp', 'ule', 'ult', 'umax', 'umin', 'undef', 'une', + 'unnamed_addr', 'uno', 'unordered', 'unreachable', 'unwind', 'urem', + 'uwtable', 'va_arg', 'void', 'volatile', 'weak', 'weak_odr', + 'x86_fastcallcc', 'x86_fp80', 'x86_mmx', 'x86_stdcallcc', 'x86_thiscallcc', + 'xchg', 'xor', 'zeroext', 'zeroinitializer', 'zext' + ); + + KeyIndices: array[0..1552] of Integer = ( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, + 64, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, 183, -1, -1, -1, 168, -1, -1, + 79, -1, -1, -1, -1, 186, -1, -1, -1, -1, -1, 209, 37, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 166, -1, -1, -1, -1, -1, -1, -1, + 211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 62, -1, + -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, + -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 169, -1, -1, -1, -1, 26, 78, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 116, 143, 93, -1, -1, -1, -1, -1, 165, -1, -1, + 132, -1, -1, -1, -1, 195, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, 173, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 119, -1, -1, 146, -1, -1, -1, -1, -1, -1, 205, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, + 207, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, 106, -1, + -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, 161, -1, -1, -1, + -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, 10, -1, + 133, -1, -1, 122, 65, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, 144, -1, + -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, 35, -1, -1, 131, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, 147, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, 196, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 202, -1, -1, -1, -1, -1, 32, -1, -1, -1, + -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 18, + -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, + -1, -1, 25, -1, -1, -1, -1, -1, 199, 185, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 55, 129, -1, 12, -1, -1, -1, 54, -1, 215, -1, + -1, -1, -1, -1, -1, -1, 115, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 75, -1, -1, -1, 138, -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, 34, -1, + -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, + 203, 88, -1, -1, -1, 42, -1, 50, -1, -1, 45, 80, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 137, -1, -1, 73, 167, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 2, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 52, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, 201, -1, -1, -1, -1, + -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, + -1, 5, -1, 3, -1, 190, -1, -1, -1, -1, -1, -1, -1, 212, -1, -1, 174, -1, -1, + 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 193, -1, -1, -1, 21, -1, -1, 121, -1, -1, 214, -1, + 84, 70, -1, -1, 47, -1, -1, -1, -1, -1, 38, -1, 16, -1, -1, -1, -1, -1, -1, + 125, -1, -1, -1, -1, -1, -1, 134, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, 123, -1, -1, -1, -1, + -1, 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 206, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, 30, 213, -1, + -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, -1, 136, -1, -1, -1, -1, + -1, -1, -1, 6, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, + -1, -1, 66, 105, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, 19, + -1, -1, 114, -1, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, + 117, 194, -1, -1, 72, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, -1, -1, + -1, 107, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, 15, -1, + 171, -1, -1, 192, -1, 200, -1, -1, 148, -1, -1, 86, 76, 63, -1, 14, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, + -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, 155, 184, -1, 97, -1, -1, + -1, -1, 149, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 163, -1, -1, -1, -1, -1, + 210, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -1, + -1, -1, -1, -1, -1, 157, -1, -1, 142, -1, 7, 51, -1, 177, -1, -1, -1, -1, + 69, -1, -1, -1, -1, -1, -1, -1, 22, -1, 127, 204, -1, -1, 158, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 140, -1, 179, -1, -1, -1, 58, -1, -1, 208, 139, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 92, 43, -1, -1, 110, 0, -1, -1, -1, 96, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, + 126, 95, -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, 150, -1, -1, -1, + -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, 60 + ); + +constructor TSynLLVMIRSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + fCaseSensitive := True; + + fBooleanAttri := TSynHighLighterAttributes.Create(SYNS_AttrBoolean, SYNS_FriendlyAttrBoolean); + fBooleanAttri.Foreground := clNavy; + AddAttribute(fBooleanAttri); + + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := $B0A060; + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + + fConstantAttri := TSynHighLighterAttributes.Create(SYNS_AttrConstant, SYNS_FriendlyAttrConstant); + fConstantAttri.Foreground := clNavy; + AddAttribute(fConstantAttri); + + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + fIdentifierAttri.Foreground := $D560BB; + AddAttribute(fIdentifierAttri); + + fInstructionAttri := TSynHighLighterAttributes.Create(SYNS_AttrInstructions, SYNS_FriendlyAttrInstructions); + fInstructionAttri.Foreground := $207000; + fInstructionAttri.Style := [fsBold]; + AddAttribute(fInstructionAttri); + + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Foreground := $207000; + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + + fLabelAttri := TSynHighLighterAttributes.Create(SYNS_AttrLabel, SYNS_FriendlyAttrLAbel); + fLabelAttri.Foreground := $702000; + fLabelAttri.Style := [fsBold]; + AddAttribute(fLabelAttri); + + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := $70A040; + AddAttribute(fNumberAttri); + + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := $A07040; + AddAttribute(fStringAttri); + + fTypesAttri := TSynHighLighterAttributes.Create(SYNS_AttrBasicTypes, SYNS_FriendlyAttrBasicTypes); + fTypesAttri.Foreground := $002090; + fTypesAttri.Style := [fsBold]; + AddAttribute(fTypesAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + fDefaultFilter := SYNS_FilterLLVMIR; + fRange := rsUnknown; +end; + +procedure TSynLLVMIRSyn.InitIdent; +var + i: Integer; +begin + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[i] = -1 then + fIdentFuncTable[i] := AltFunc; + + fIdentFuncTable[1458] := FuncKey; // acq95rel + fIdentFuncTable[659] := FuncKey; // acquire + fIdentFuncTable[843] := FuncInstruction; // add + fIdentFuncTable[916] := FuncKey; // addrspace + fIdentFuncTable[1346] := FuncKey; // alias + fIdentFuncTable[914] := FuncKey; // align + fIdentFuncTable[1158] := FuncKey; // alignstack + fIdentFuncTable[1385] := FuncInstruction; // alloca + fIdentFuncTable[107] := FuncKey; // alwaysinline + fIdentFuncTable[44] := FuncInstruction; // and + fIdentFuncTable[372] := FuncKey; // appending + fIdentFuncTable[32] := FuncInstruction; // arcp + fIdentFuncTable[624] := FuncKey; // arm95aapcs95vfpcc + fIdentFuncTable[1512] := FuncKey; // arm95aapcscc + fIdentFuncTable[1261] := FuncKey; // arm95apcscc + fIdentFuncTable[1244] := FuncInstruction; // ashr + fIdentFuncTable[1019] := FuncKey; // asm + fIdentFuncTable[359] := FuncKey; // atomic + fIdentFuncTable[557] := FuncInstruction; // atomicrmw + fIdentFuncTable[1191] := FuncKey; // available95externally + fIdentFuncTable[1489] := FuncInstruction; // bitcast + fIdentFuncTable[999] := FuncKey; // blockaddress + fIdentFuncTable[1401] := FuncInstruction; // br + fIdentFuncTable[337] := FuncKey; // byval + fIdentFuncTable[366] := FuncKey; // c + fIdentFuncTable[598] := FuncInstruction; // call + fIdentFuncTable[179] := FuncKey; // catch + fIdentFuncTable[1308] := FuncKey; // cc + fIdentFuncTable[932] := FuncKey; // ccc + fIdentFuncTable[1241] := FuncKey; // cleanup + fIdentFuncTable[1115] := FuncInstruction; // cmpxchg + fIdentFuncTable[1111] := FuncKey; // coldcc + fIdentFuncTable[536] := FuncKey; // common + fIdentFuncTable[145] := FuncKey; // constant + fIdentFuncTable[723] := FuncKey; // datalayout + fIdentFuncTable[458] := FuncKey; // declare + fIdentFuncTable[238] := FuncKey; // default + fIdentFuncTable[69] := FuncKey; // define + fIdentFuncTable[1017] := FuncKey; // deplibs + fIdentFuncTable[589] := FuncKey; // dllexport + fIdentFuncTable[20] := FuncKey; // dllimport + fIdentFuncTable[217] := FuncType; // double + fIdentFuncTable[767] := FuncInstruction; // eq + fIdentFuncTable[1454] := FuncInstruction; // exact + fIdentFuncTable[1359] := FuncKey; // except + fIdentFuncTable[772] := FuncKey; // extern95weak + fIdentFuncTable[1122] := FuncKey; // external + fIdentFuncTable[1011] := FuncInstruction; // extractelement + fIdentFuncTable[889] := FuncInstruction; // extractvalue + fIdentFuncTable[1090] := FuncInstruction; // fadd + fIdentFuncTable[769] := FuncBoolean; // false + fIdentFuncTable[1386] := FuncInstruction; // fast + fIdentFuncTable[856] := FuncKey; // fastcc + fIdentFuncTable[381] := FuncInstruction; // fcmp + fIdentFuncTable[628] := FuncInstruction; // fdiv + fIdentFuncTable[621] := FuncInstruction; // fence + fIdentFuncTable[1525] := FuncKey; // filter + fIdentFuncTable[434] := FuncType; // float + fIdentFuncTable[1424] := FuncInstruction; // fmul + fIdentFuncTable[456] := FuncType; // fp128 + fIdentFuncTable[1552] := FuncInstruction; // fpext + fIdentFuncTable[911] := FuncInstruction; // fptosi + fIdentFuncTable[130] := FuncInstruction; // fptoui + fIdentFuncTable[1259] := FuncInstruction; // fptrunc + fIdentFuncTable[19] := FuncInstruction; // free + fIdentFuncTable[378] := FuncInstruction; // frem + fIdentFuncTable[1176] := FuncInstruction; // fsub + fIdentFuncTable[1299] := FuncKey; // gc + fIdentFuncTable[1147] := FuncInstruction; // getelementptr + fIdentFuncTable[1393] := FuncKey; // global + fIdentFuncTable[1008] := FuncType; // half + fIdentFuncTable[846] := FuncKey; // hidden + fIdentFuncTable[1214] := FuncInstruction; // icmp + fIdentFuncTable[789] := FuncInstruction; // inbounds + fIdentFuncTable[563] := FuncInstruction; // indirectbr + fIdentFuncTable[708] := FuncKey; // initialexec + fIdentFuncTable[1258] := FuncKey; // inlinehint + fIdentFuncTable[493] := FuncKey; // inreg + fIdentFuncTable[180] := FuncInstruction; // insertelement + fIdentFuncTable[57] := FuncInstruction; // insertvalue + fIdentFuncTable[773] := FuncKey; // intel95ocl95bicc + fIdentFuncTable[572] := FuncKey; // inteldialect + fIdentFuncTable[828] := FuncKey; // internal + fIdentFuncTable[965] := FuncInstruction; // inttoptr + fIdentFuncTable[1007] := FuncInstruction; // invoke + fIdentFuncTable[313] := FuncType; // label + fIdentFuncTable[1257] := FuncInstruction; // landingpad + fIdentFuncTable[977] := FuncKey; // linker95private + fIdentFuncTable[763] := FuncKey; // linker95private95weak + fIdentFuncTable[348] := FuncKey; // linker95private95weak95def95auto + fIdentFuncTable[863] := FuncKey; // linkonce + fIdentFuncTable[137] := FuncKey; // linkonce95odr + fIdentFuncTable[1453] := FuncKey; // linkonce95odr95auto95hide + fIdentFuncTable[198] := FuncInstruction; // load + fIdentFuncTable[671] := FuncKey; // localdynamic + fIdentFuncTable[1506] := FuncKey; // localexec + fIdentFuncTable[1462] := FuncInstruction; // lshr + fIdentFuncTable[1317] := FuncInstruction; // malloc + fIdentFuncTable[984] := FuncInstruction; // max + fIdentFuncTable[476] := FuncType; // metadata + fIdentFuncTable[129] := FuncInstruction; // min + fIdentFuncTable[1550] := FuncKey; // minsize + fIdentFuncTable[1159] := FuncKey; // module + fIdentFuncTable[1540] := FuncKey; // monotonic + fIdentFuncTable[1103] := FuncKey; // msp43095intrcc + fIdentFuncTable[1177] := FuncInstruction; // mul + fIdentFuncTable[334] := FuncKey; // naked + fIdentFuncTable[1229] := FuncInstruction; // nand + fIdentFuncTable[1373] := FuncInstruction; // ne + fIdentFuncTable[646] := FuncKey; // nest + fIdentFuncTable[1457] := FuncInstruction; // ninf + fIdentFuncTable[322] := FuncInstruction; // nnan + fIdentFuncTable[1504] := FuncKey; // noalias + fIdentFuncTable[879] := FuncKey; // nocapture + fIdentFuncTable[1194] := FuncKey; // noimplicitfloat + fIdentFuncTable[638] := FuncKey; // noinline + fIdentFuncTable[196] := FuncKey; // nonlazybind + fIdentFuncTable[1210] := FuncKey; // noredzone + fIdentFuncTable[1138] := FuncKey; // noreturn + fIdentFuncTable[248] := FuncKey; // nounwind + fIdentFuncTable[285] := FuncInstruction; // nsw + fIdentFuncTable[1002] := FuncInstruction; // nsz + fIdentFuncTable[377] := FuncConstant; // null + fIdentFuncTable[1057] := FuncInstruction; // nuw + fIdentFuncTable[16] := FuncInstruction; // oeq + fIdentFuncTable[1026] := FuncInstruction; // oge + fIdentFuncTable[1505] := FuncInstruction; // ogt + fIdentFuncTable[1403] := FuncInstruction; // ole + fIdentFuncTable[329] := FuncInstruction; // olt + fIdentFuncTable[622] := FuncInstruction; // one + fIdentFuncTable[801] := FuncType; // opaque + fIdentFuncTable[461] := FuncKey; // optsize + fIdentFuncTable[207] := FuncInstruction; // or + fIdentFuncTable[374] := FuncInstruction; // ord + fIdentFuncTable[1033] := FuncKey; // personality + fIdentFuncTable[1172] := FuncInstruction; // phi + fIdentFuncTable[1150] := FuncType; // ppc95fp128 + fIdentFuncTable[786] := FuncKey; // private + fIdentFuncTable[712] := FuncKey; // protected + fIdentFuncTable[1428] := FuncInstruction; // ptrtoint + fIdentFuncTable[1418] := FuncKey; // ptx95device + fIdentFuncTable[507] := FuncKey; // ptx95kernel + fIdentFuncTable[1383] := FuncKey; // readnone + fIdentFuncTable[197] := FuncKey; // readonly + fIdentFuncTable[427] := FuncKey; // release + fIdentFuncTable[697] := FuncInstruction; // resume + fIdentFuncTable[251] := FuncInstruction; // ret + fIdentFuncTable[482] := FuncKey; // returns95twice + fIdentFuncTable[1254] := FuncKey; // sanitize95address + fIdentFuncTable[1322] := FuncKey; // sanitize95memory + fIdentFuncTable[1519] := FuncKey; // sanitize95thread + fIdentFuncTable[304] := FuncInstruction; // sdiv + fIdentFuncTable[1220] := FuncKey; // section + fIdentFuncTable[754] := FuncInstruction; // select + fIdentFuncTable[1056] := FuncKey; // seq95cst + fIdentFuncTable[1314] := FuncInstruction; // sext + fIdentFuncTable[901] := FuncInstruction; // sge + fIdentFuncTable[1380] := FuncInstruction; // sgt + fIdentFuncTable[1407] := FuncInstruction; // shl + fIdentFuncTable[447] := FuncInstruction; // shufflevector + fIdentFuncTable[715] := FuncKey; // sideeffect + fIdentFuncTable[351] := FuncKey; // signext + fIdentFuncTable[729] := FuncKey; // singlethread + fIdentFuncTable[1351] := FuncInstruction; // sitofp + fIdentFuncTable[1278] := FuncInstruction; // sle + fIdentFuncTable[204] := FuncInstruction; // slt + fIdentFuncTable[86] := FuncInstruction; // spir95func + fIdentFuncTable[790] := FuncInstruction; // spir95kernel + fIdentFuncTable[54] := FuncInstruction; // srem + fIdentFuncTable[174] := FuncKey; // sret + fIdentFuncTable[397] := FuncKey; // ssp + fIdentFuncTable[1246] := FuncKey; // sspreq + fIdentFuncTable[1189] := FuncKey; // sspstrong + fIdentFuncTable[223] := FuncInstruction; // store + fIdentFuncTable[929] := FuncInstruction; // sub + fIdentFuncTable[1201] := FuncInstruction; // switch + fIdentFuncTable[1324] := FuncKey; // tail + fIdentFuncTable[1388] := FuncKey; // target + fIdentFuncTable[952] := FuncKey; // thread95local + fIdentFuncTable[1420] := FuncKey; // to + fIdentFuncTable[745] := FuncKey; // triple + fIdentFuncTable[1034] := FuncBoolean; // true + fIdentFuncTable[152] := FuncInstruction; // trunc + fIdentFuncTable[50] := FuncInstruction; // type + fIdentFuncTable[1315] := FuncInstruction; // udiv + fIdentFuncTable[605] := FuncInstruction; // ueq + fIdentFuncTable[62] := FuncInstruction; // uge + fIdentFuncTable[541] := FuncInstruction; // ugt + fIdentFuncTable[513] := FuncInstruction; // uitofp + fIdentFuncTable[439] := FuncInstruction; // ule + fIdentFuncTable[918] := FuncInstruction; // ult + fIdentFuncTable[551] := FuncInstruction; // umax + fIdentFuncTable[1249] := FuncInstruction; // umin + fIdentFuncTable[995] := FuncConstant; // undef + fIdentFuncTable[1211] := FuncInstruction; // une + fIdentFuncTable[212] := FuncKey; // unnamed95addr + fIdentFuncTable[495] := FuncInstruction; // uno + fIdentFuncTable[426] := FuncKey; // unordered + fIdentFuncTable[1180] := FuncInstruction; // unreachable + fIdentFuncTable[604] := FuncInstruction; // unwind + fIdentFuncTable[1251] := FuncInstruction; // urem + fIdentFuncTable[870] := FuncKey; // uwtable + fIdentFuncTable[530] := FuncInstruction; // va95arg + fIdentFuncTable[762] := FuncType; // void + fIdentFuncTable[1404] := FuncKey; // volatile + fIdentFuncTable[258] := FuncKey; // weak + fIdentFuncTable[1081] := FuncKey; // weak95odr + fIdentFuncTable[318] := FuncKey; // x8695fastcallcc + fIdentFuncTable[1427] := FuncType; // x8695fp80 + fIdentFuncTable[68] := FuncType; // x8695mmx + fIdentFuncTable[1357] := FuncKey; // x8695stdcallcc + fIdentFuncTable[94] := FuncKey; // x8695thiscallcc + fIdentFuncTable[926] := FuncInstruction; // xchg + fIdentFuncTable[1116] := FuncInstruction; // xor + fIdentFuncTable[1005] := FuncKey; // zeroext + fIdentFuncTable[630] := FuncConstant; // zeroinitializer + fIdentFuncTable[1063] := FuncInstruction; // zext +end; + +{$Q-} +function TSynLLVMIRSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 359 + Ord(Str^) * 239; + Inc(Str); + end; + Result := Result mod 1553; + fStringLen := Str - fToIdent; +end; +{$Q+} + +function TSynLLVMIRSyn.FuncBoolean(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkBoolean + else + Result := tkIdentifier; +end; + +function TSynLLVMIRSyn.FuncConstant(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkConstant + else + Result := tkIdentifier; +end; + +function TSynLLVMIRSyn.FuncInstruction(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkInstruction + else + Result := tkIdentifier; +end; + +function TSynLLVMIRSyn.FuncKey(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynLLVMIRSyn.FuncType(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkType + else + Result := tkIdentifier; +end; + +function TSynLLVMIRSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynLLVMIRSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Key: Cardinal; +begin + fToIdent := MayBe; + Key := HashKey(MayBe); + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) + else + Result := tkIdentifier; +end; + +procedure TSynLLVMIRSyn.SpaceProc; +begin + inc(Run); + fTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); +end; + +procedure TSynLLVMIRSyn.NullProc; +begin + fTokenID := tkNull; + inc(Run); +end; + +procedure TSynLLVMIRSyn.CRProc; +begin + fTokenID := tkSpace; + inc(Run); + if fLine[Run] = #10 then + inc(Run); +end; + +procedure TSynLLVMIRSyn.LFProc; +begin + fTokenID := tkSpace; + inc(Run); +end; + +procedure TSynLLVMIRSyn.IntegerTypeProc; +begin + case FLine[Succ(Run)] of + '0'..'9': + begin + fTokenID := tkType; + repeat + Inc(Run); + case fLine[Run] of + '0'..'9':; + else + Exit; + end; + until IsLineEnd(Run); + end + else + IdentProc; + end; +end; + +procedure TSynLLVMIRSyn.AtTypeProc; +begin + // @ = global identifiers + fTokenID := tkUnknown; + + Inc(Run); + if IsLineEnd(Run) then + Exit; + + case fLine[Run] of + '0'..'9': fTokenID := tkUnnamedIdentifier; + '-', '_', 'A'..'Z', 'a'..'z': fTokenID := tkIdentifier; + '"': + begin + Inc(Run); + StringProc; + fTokenID := tkIdentifier; + Exit; + end; + end; + + repeat + Inc(Run); + case fLine[Run] of + '0'..'9', '-', '_', '.', 'A'..'Z', 'a'..'z':; + else + Exit; + end; + until IsLineEnd(Run); +end; + +procedure TSynLLVMIRSyn.PercentTypeProc; +begin + // % = local identifiers + fTokenID := tkUnknown; + + Inc(Run); + if IsLineEnd(Run) then + Exit; + + case fLine[Run] of + '0'..'9': fTokenID := tkUnnamedIdentifier; + '-', '_', '.', 'A'..'Z', 'a'..'z': fTokenID := tkIdentifier; + '"': + begin + Inc(Run); + StringProc; + fTokenID := tkIdentifier; + Exit; + end; + end; + + repeat + Inc(Run); + case fLine[Run] of + '0'..'9', '-', '_', '.', 'A'..'Z', 'a'..'z':; + else + Exit; + end; + until IsLineEnd(Run); +end; + +procedure TSynLLVMIRSyn.SingleCommentOpenProc; +begin + Inc(Run); + fRange := rsSingleComment; + SingleCommentProc; + fTokenID := tkComment; +end; + +procedure TSynLLVMIRSyn.SingleCommentProc; +begin + fTokenID := tkComment; + while not IsLineEnd(Run) do + Inc(Run); +end; + +procedure TSynLLVMIRSyn.StringOpenProc; +begin + Inc(Run); + fRange := rsString; + StringProc; + fTokenID := tkString; +end; + +procedure TSynLLVMIRSyn.StringProc; +begin + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + fTokenID := tkString; + repeat + if (fLine[Run] = '"') then + begin + Inc(Run, 1); + fRange := rsUnKnown; + Break; + end; + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynLLVMIRSyn.NumberProc; + + function IsNumberChar(Run: Integer): Boolean; + begin + case fLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f', '.', 'x', 'X', '-', '+': + Result := True; + else + Result := False; + end; + end; + + function IsDigitPlusMinusChar(Run: Integer): Boolean; + begin + case fLine[Run] of + '0'..'9', '+', '-': + Result := True; + else + Result := False; + end; + end; + + function IsHexDigit(Run: Integer): Boolean; + begin + case fLine[Run] of + '0'..'9', 'a'..'f', 'A'..'F': + Result := True; + else + Result := False; + end; + end; + + function IsAlphaUncerscore(Run: Integer): Boolean; + begin + case fLine[Run] of + 'A'..'Z', 'a'..'z', '_': + Result := True; + else + Result := False; + end; + end; + +var + idx1: Integer; // token[1] + i: Integer; +begin + idx1 := Run; + Inc(Run); + fTokenID := tkNumber; + while IsNumberChar(Run) do + begin + case FLine[Run] of + '.': + if FLine[Succ(Run)] = '.' then + Break + else + if (fTokenID <> tkHex) then + fTokenID := tkFloat + else // invalid + begin + fTokenID := tkUnknown; + Exit; + end; + '-', '+': + begin + if fTokenID <> tkFloat then // number <> float. an arithmetic operator + Exit; + if not CharInSet(FLine[Pred(Run)], ['e', 'E']) then + Exit; // number = float, but no exponent. an arithmetic operator + if not IsDigitPlusMinusChar(Succ(Run)) then // invalid + begin + Inc(Run); + fTokenID := tkUnknown; + Exit; + end + end; + '0'..'9': ; + 'a'..'d', 'f', 'A'..'D', 'F': + if fTokenID <> tkHex then // invalid char + Break; + 'e', 'E': + if (fTokenID <> tkHex) then + if CharInSet(FLine[Pred(Run)], ['0'..'9']) then // exponent + begin + for i := idx1 to Pred(Run) do + if CharInSet(FLine[i], ['e', 'E']) then // too many exponents + begin + fTokenID := tkUnknown; + Exit; + end; + if not IsDigitPlusMinusChar(Succ(Run)) then + Break + else + fTokenID := tkFloat + end + else // invalid char + Break; + 'x', 'X': + if (Run = Succ(idx1)) and // 0x... 'x' must be second char + (FLine[idx1] = '0') and // 0x... + IsHexDigit(Succ(Run)) then // 0x... must be continued with a number + fTokenID := tkHex + else // invalid char + begin + if not IsIdentChar(fLine[Succ(Run)]) and + CharInSet(FLine[Succ(idx1)], ['x', 'X']) then + begin + Inc(Run); // highlight 'x' too + fTokenID := tkUnknown; + end; + Break; + end; + end; // case + Inc(Run); + end; // while + if IsAlphaUncerscore(Run) then + fTokenID := tkUnknown; +end; + +procedure TSynLLVMIRSyn.IdentProc; +begin + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do + Inc(Run); + + if fLine[Run] = ':' then + begin + fTokenID := tkLabel; + Inc(Run); + end; +end; + +procedure TSynLLVMIRSyn.UnknownProc; +begin + inc(Run); + fTokenID := tkUnknown; +end; + +procedure TSynLLVMIRSyn.Next; +begin + fTokenPos := Run; + case fRange of + rsString: StringProc; + else + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + ';': SingleCommentOpenProc; + '"': StringOpenProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '0'..'9': NumberProc; + 'A'..'Z', 'a'..'h', 'j'..'z', '_': IdentProc; + 'i': IntegerTypeProc; + '@': AtTypeProc; + '%': PercentTypeProc; + else + UnknownProc; + end; + end; + inherited; +end; + +function TSynLLVMIRSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + else + Result := nil; + end; +end; + +function TSynLLVMIRSyn.GetEol: Boolean; +begin + Result := Run = fLineLen + 1; +end; + +function TSynLLVMIRSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +begin + Result := + 'acq_rel,acquire,add,addrspace,alias,align,alignstack,alloca,alwaysinl' + + 'ine,and,appending,arcp,arm_aapcs_vfpcc,arm_aapcscc,arm_apcscc,ashr,asm' + + ',atomic,atomicrmw,available_externally,bitcast,blockaddress,br,byval,c' + + ',call,catch,cc,ccc,cleanup,cmpxchg,coldcc,common,constant,datalayout,d' + + 'eclare,default,define,deplibs,dllexport,dllimport,double,eq,exact,exce' + + 'pt,extern_weak,external,extractelement,extractvalue,fadd,false,fast,fa' + + 'stcc,fcmp,fdiv,fence,filter,float,fmul,fp128,fpext,fptosi,fptoui,fptru' + + 'nc,free,frem,fsub,gc,getelementptr,global,half,hidden,icmp,inbounds,in' + + 'directbr,initialexec,inlinehint,inreg,insertelement,insertvalue,intel_' + + 'ocl_bicc,inteldialect,internal,inttoptr,invoke,label,landingpad,linker' + + '_private,linker_private_weak,linker_private_weak_def_auto,linkonce,lin' + + 'konce_odr,linkonce_odr_auto_hide,load,localdynamic,localexec,lshr,mall' + + 'oc,max,metadata,min,minsize,module,monotonic,msp430_intrcc,mul,naked,n' + + 'and,ne,nest,ninf,nnan,noalias,nocapture,noimplicitfloat,noinline,nonla' + + 'zybind,noredzone,noreturn,nounwind,nsw,nsz,null,nuw,oeq,oge,ogt,ole,ol' + + 't,one,opaque,optsize,or,ord,personality,phi,ppc_fp128,private,protecte' + + 'd,ptrtoint,ptx_device,ptx_kernel,readnone,readonly,release,resume,ret,' + + 'returns_twice,sanitize_address,sanitize_memory,sanitize_thread,sdiv,se' + + 'ction,select,seq_cst,sext,sge,sgt,shl,shufflevector,sideeffect,signext' + + ',singlethread,sitofp,sle,slt,spir_func,spir_kernel,srem,sret,ssp,sspre' + + 'q,sspstrong,store,sub,switch,tail,target,thread_local,to,triple,true,t' + + 'runc,type,udiv,ueq,uge,ugt,uitofp,ule,ult,umax,umin,undef,une,unnamed_' + + 'addr,uno,unordered,unreachable,unwind,urem,uwtable,va_arg,void,volatil' + + 'e,weak,weak_odr,x86_fastcallcc,x86_fp80,x86_mmx,x86_stdcallcc,x86_this' + + 'callcc,xchg,xor,zeroext,zeroinitializer,zext'; +end; + +function TSynLLVMIRSyn.GetTokenID: TtkTokenKind; +begin + Result := fTokenId; +end; + +function TSynLLVMIRSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkBoolean: Result := fBooleanAttri; + tkComment: Result := fCommentAttri; + tkConstant: Result := fConstantAttri; + tkIdentifier, tkUnnamedIdentifier: Result := fIdentifierAttri; + tkInstruction: Result := fInstructionAttri; + tkKey: Result := fKeyAttri; + tkLabel: Result := fLabelAttri; + tkNumber, tkFloat, tkHex: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkType: Result := fTypesAttri; + tkUnknown: Result := fIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynLLVMIRSyn.GetTokenKind: Integer; +begin + Result := Ord(fTokenId); +end; + +function TSynLLVMIRSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', '.', '0'..'9', 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; +end; + +function TSynLLVMIRSyn.GetSampleSource: UnicodeString; +begin + Result := + '; Declare the string constant as global constant' + #10#13 + '@.msg = ' + + 'internal constant [13 x i8] c"Hello World!\00"' + #10#13 + #10#13 + + '; External declaration of puts function' + #10#13 + 'declare i32 ' + + '@puts(i8*)' + #10#13 + #10#13 + '; Definition of main function' + #10#13 + + 'define i32 @main() {' + #10#13 + 'entry:' + #10#13 + #9 + + '; Convert [13 x i8]* to i8 *...' + #10#13 + #9 + + '%cast210 = getelementptr inbounds ([13 x i8]* @.msg, i32 0, i32 0)' + + #10#13 + #10#13 + #9 + '; Call puts function to write out the string to ' + + 'stdout' + #10#13 + #9 + 'call i32 @puts(i8* %cast210)' + #10#13 + + #9 + 'ret i32 0' + #10#13 + '}'; + +end; + +function TSynLLVMIRSyn.IsFilterStored: Boolean; +begin + Result := fDefaultFilter <> SYNS_FilterLLVMIR; +end; + +class function TSynLLVMIRSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangLLVMIR; +end; + +class function TSynLLVMIRSyn.GetLanguageName: string; +begin + Result := SYNS_LangLLVMIR; +end; + +procedure TSynLLVMIRSyn.ResetRange; +begin + fRange := rsUnknown; +end; + +procedure TSynLLVMIRSyn.SetRange(Value: Pointer); +begin + fRange := TRangeState(Value); +end; + +function TSynLLVMIRSyn.GetRange: Pointer; +begin + Result := Pointer(fRange); +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynLLVMIRSyn); +{$ENDIF} +end. diff --git a/components/synedit/Source/SynHighlighterWebIDL.pas b/components/synedit/Source/SynHighlighterWebIDL.pas new file mode 100644 index 00000000..652243e3 --- /dev/null +++ b/components/synedit/Source/SynHighlighterWebIDL.pas @@ -0,0 +1,1061 @@ +{------------------------------------------------------------------------------- +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for +the specific language governing rights and limitations under the License. + +Code template generated with SynGen. +The original code is: SynHighlighterWebIDL.pas, released 2013-02-14. +Description: Syntax Parser/Highlighter +The initial author of this file is Christian-W. Budde. +Copyright (c) 2013, all rights reserved. + +Contributors to the SynEdit and mwEdit projects are listed in the +Contributors.txt file. + +Alternatively, the contents of this file may be used under the terms of the +GNU General Public License Version 2 or later (the "GPL"), in which case +the provisions of the GPL are applicable instead of those above. +If you wish to allow use of your version of this file only under the terms +of the GPL and not to allow others to use your version of this file +under the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the GPL. +If you do not delete the provisions above, a recipient may use your version +of this file under either the MPL or the GPL. + +$Id: $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +{$IFNDEF QWEBIDL} +unit SynHighlighterWebIDL; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses +{$IFDEF SYN_CLX} + QGraphics, + QSynEditTypes, + QSynEditHighlighter, + QSynUnicode, +{$ELSE} + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, +{$ENDIF} + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkArguments, + tkComment, + tkExtendedAttributes, + tkIdentifier, + tkKey, + tkNull, + tkNumber, + tkSpace, + tkString, + tkTypes, + tkSymbol, + tkUnknown); + + TstkSymbolTokenKind = ( + stkBraceOpen, + stkBraceClose, + stkSquareOpen, + stkSquareClose, + stkQuestionMark, + stkColon, + stkGreater, + stkLess + ); + + TRangeState = (rsUnknown, rsSingleComment, rsCStyleComment, rsString, + rsExtendedAttributes); + + TProcTableProc = procedure of object; + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynWebIDLSyn = class(TSynCustomHighlighter) + private + fRange: TRangeState; + fTokenID: TtkTokenKind; + fSymbolTokenID: TstkSymbolTokenKind; + fIdentFuncTable: array [0..58] of TIdentFuncTableFunc; + fArgumentsAttri: TSynHighlighterAttributes; + fExtendedAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fTypesAttri: TSynHighlighterAttributes; + function HashKey(Str: PWideChar): Cardinal; + function FuncAny(Index: Integer): TtkTokenKind; + function FuncAttribute(Index: Integer): TtkTokenKind; + function FuncBoolean(Index: Integer): TtkTokenKind; + function FuncByte(Index: Integer): TtkTokenKind; + function FuncBytestring(Index: Integer): TtkTokenKind; + function FuncCallback(Index: Integer): TtkTokenKind; + function FuncConst(Index: Integer): TtkTokenKind; + function FuncCreator(Index: Integer): TtkTokenKind; + function FuncDate(Index: Integer): TtkTokenKind; + function FuncDeleter(Index: Integer): TtkTokenKind; + function FuncDictionary(Index: Integer): TtkTokenKind; + function FuncDomstring(Index: Integer): TtkTokenKind; + function FuncDouble(Index: Integer): TtkTokenKind; + function FuncEnum(Index: Integer): TtkTokenKind; + function FuncException(Index: Integer): TtkTokenKind; + function FuncFloat(Index: Integer): TtkTokenKind; + function FuncGetter(Index: Integer): TtkTokenKind; + function FuncImplements(Index: Integer): TtkTokenKind; + function FuncInherit(Index: Integer): TtkTokenKind; + function FuncInterface(Index: Integer): TtkTokenKind; + function FuncLegacycaller(Index: Integer): TtkTokenKind; + function FuncLong(Index: Integer): TtkTokenKind; + function FuncObject(Index: Integer): TtkTokenKind; + function FuncOctet(Index: Integer): TtkTokenKind; + function FuncOptional(Index: Integer): TtkTokenKind; + function FuncPartial(Index: Integer): TtkTokenKind; + function FuncReadonly(Index: Integer): TtkTokenKind; + function FuncRegexp(Index: Integer): TtkTokenKind; + function FuncSequence(Index: Integer): TtkTokenKind; + function FuncSetter(Index: Integer): TtkTokenKind; + function FuncShort(Index: Integer): TtkTokenKind; + function FuncStatic(Index: Integer): TtkTokenKind; + function FuncStringifier(Index: Integer): TtkTokenKind; + function FuncTypedef(Index: Integer): TtkTokenKind; + function FuncUnresticted(Index: Integer): TtkTokenKind; + function FuncUnrestricted(Index: Integer): TtkTokenKind; + function FuncUnsigned(Index: Integer): TtkTokenKind; + function FuncVoid(Index: Integer): TtkTokenKind; + procedure IdentProc; + procedure UnknownProc; + function AltFunc(Index: Integer): TtkTokenKind; + procedure InitIdent; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure ColonProc; + procedure CRProc; + procedure CStyleCommentProc; + procedure GreaterProc; + procedure LessProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure QuestionMarkProc; + procedure SlashProc; + procedure SpaceProc; + procedure SquareCloseProc; + procedure SquareOpenProc; + procedure StringOpenProc; + procedure StringProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + constructor Create(AOwner: TComponent); override; + class function GetFriendlyLanguageName: UnicodeString; override; + class function GetLanguageName: string; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; + function GetEol: Boolean; override; + function GetKeyWords(TokenKind: Integer): UnicodeString; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property ArgumentsAttri: TSynHighlighterAttributes read fArgumentsAttri write fArgumentsAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property ExtendedAttri: TSynHighlighterAttributes read fExtendedAttri write fExtendedAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; + property TypesAttri: TSynHighlighterAttributes read fTypesAttri write fTypesAttri; + end; + +implementation + +uses +{$IFDEF SYN_CLX} + QSynEditStrConst; +{$ELSE} + SynEditStrConst; +{$ENDIF} + +resourcestring + SYNS_FilterWebIDL = 'Web IDL (*.idl)|*.idl'; + SYNS_LangWebIDL = 'Web IDL'; + SYNS_FriendlyLangWebIDL = 'Web IDL'; + SYNS_AttrArguments = 'Arguments'; + SYNS_FriendlyAttrArguments = 'Arguments'; + SYNS_AttrExtended = 'Extended'; + SYNS_FriendlyAttrExtended = 'Extended'; + +const + // as this language is case-insensitive keywords *must* be in lowercase + KeyWords: array[0..37] of UnicodeString = ( + 'any', 'attribute', 'boolean', 'byte', 'bytestring', 'callback', 'const', + 'creator', 'date', 'deleter', 'dictionary', 'domstring', 'double', 'enum', + 'exception', 'float', 'getter', 'implements', 'inherit', 'interface', + 'legacycaller', 'long', 'object', 'octet', 'optional', 'partial', + 'readonly', 'regexp', 'sequence', 'setter', 'short', 'static', + 'stringifier', 'typedef', 'unresticted', 'unrestricted', 'unsigned', 'void' + ); + + KeyIndices: array[0..58] of Integer = ( + 14, 28, 4, 37, 21, -1, -1, 12, 17, -1, -1, 22, -1, 3, -1, -1, 29, -1, 27, + 31, -1, 1, 20, -1, 24, 15, 2, -1, -1, -1, -1, 23, -1, 19, 0, 13, 11, 16, 34, + 10, 36, 25, -1, 30, -1, 33, 32, 6, -1, 9, 7, -1, 8, -1, 26, 18, -1, 5, 35 + ); + +constructor TSynWebIDLSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + fCaseSensitive := False; + + fArgumentsAttri := TSynHighLighterAttributes.Create(SYNS_AttrArguments, + SYNS_FriendlyAttrArguments); + fArgumentsAttri.Style := [fsBold]; + fArgumentsAttri.Foreground := clNavy; + AddAttribute(fArgumentsAttri); + + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, + SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clGreen; + AddAttribute(fCommentAttri); + + fExtendedAttri := TSynHighlighterAttributes.Create(SYNS_AttrExtended, + SYNS_FriendlyAttrExtended); + fExtendedAttri.Style := [fsBold, fsItalic]; + fExtendedAttri.Foreground := clMaroon; + AddAttribute(fExtendedAttri); + + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, + SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, + SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + fKeyAttri.Foreground := clNavy; + AddAttribute(fKeyAttri); + + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clBlue; + AddAttribute(fNumberAttri); + + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clPurple; + AddAttribute(fStringAttri); + + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + fSymbolAttri.Style := [fsBold]; + fSymbolAttri.Foreground := clMaroon; + AddAttribute(fSymbolAttri); + + fTypesAttri := TSynHighLighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + fTypesAttri.Foreground := clNavy; + AddAttribute(fTypesAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + fDefaultFilter := SYNS_FilterWebIDL; + fRange := rsUnknown; +end; + +procedure TSynWebIDLSyn.InitIdent; +var + i: Integer; +begin + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[i] = -1 then + fIdentFuncTable[i] := AltFunc; + + fIdentFuncTable[34] := FuncAny; + fIdentFuncTable[21] := FuncAttribute; + fIdentFuncTable[26] := FuncBoolean; + fIdentFuncTable[13] := FuncByte; + fIdentFuncTable[2] := FuncBytestring; + fIdentFuncTable[57] := FuncCallback; + fIdentFuncTable[47] := FuncConst; + fIdentFuncTable[50] := FuncCreator; + fIdentFuncTable[52] := FuncDate; + fIdentFuncTable[49] := FuncDeleter; + fIdentFuncTable[39] := FuncDictionary; + fIdentFuncTable[36] := FuncDomstring; + fIdentFuncTable[7] := FuncDouble; + fIdentFuncTable[35] := FuncEnum; + fIdentFuncTable[0] := FuncException; + fIdentFuncTable[25] := FuncFloat; + fIdentFuncTable[37] := FuncGetter; + fIdentFuncTable[8] := FuncImplements; + fIdentFuncTable[55] := FuncInherit; + fIdentFuncTable[33] := FuncInterface; + fIdentFuncTable[22] := FuncLegacycaller; + fIdentFuncTable[4] := FuncLong; + fIdentFuncTable[11] := FuncObject; + fIdentFuncTable[31] := FuncOctet; + fIdentFuncTable[24] := FuncOptional; + fIdentFuncTable[41] := FuncPartial; + fIdentFuncTable[54] := FuncReadonly; + fIdentFuncTable[18] := FuncRegexp; + fIdentFuncTable[1] := FuncSequence; + fIdentFuncTable[16] := FuncSetter; + fIdentFuncTable[43] := FuncShort; + fIdentFuncTable[19] := FuncStatic; + fIdentFuncTable[46] := FuncStringifier; + fIdentFuncTable[45] := FuncTypedef; + fIdentFuncTable[38] := FuncUnresticted; + fIdentFuncTable[58] := FuncUnrestricted; + fIdentFuncTable[40] := FuncUnsigned; + fIdentFuncTable[3] := FuncVoid; +end; + +procedure TSynWebIDLSyn.ColonProc; +begin + Inc(Run); + fTokenId := tkSymbol; + fSymbolTokenID := stkColon; +end; + +{$Q-} +function TSynWebIDLSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 622 + Ord(Str^) * 657; + inc(Str); + end; + Result := Result mod 59; + fStringLen := Str - fToIdent; +end; +{$Q+} + +function TSynWebIDLSyn.FuncAny(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncAttribute(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncBoolean(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncByte(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncBytestring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncCallback(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncConst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncCreator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncDate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncDeleter(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncDictionary(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncDomstring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncDouble(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncEnum(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncException(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncFloat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncGetter(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncImplements(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncInherit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncInterface(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncLegacycaller(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncLong(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncObject(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncOctet(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncOptional(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncPartial(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncReadonly(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncRegexp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncSequence(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncSetter(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncShort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncStatic(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncStringifier(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncTypedef(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncUnresticted(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncUnrestricted(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkArguments + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncUnsigned(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.FuncVoid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTypes + else + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynWebIDLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Key: Cardinal; +begin + fToIdent := MayBe; + Key := HashKey(MayBe); + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) + else + Result := tkIdentifier; +end; + +procedure TSynWebIDLSyn.SpaceProc; +begin + inc(Run); + fTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); +end; + +procedure TSynWebIDLSyn.NullProc; +begin + fTokenID := tkNull; + inc(Run); +end; + +procedure TSynWebIDLSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case fLine[Run] of + '0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X': + Result := True; + else + Result := False; + end; + end; + + function IsHexChar(Run: Integer): Boolean; + begin + case fLine[Run] of + '0'..'9', 'a'..'f', 'A'..'F': + Result := True; + else + Result := False; + end; + end; + +var + idx1: Integer; // token[1] + isHex: Boolean; +begin + fTokenID := tkNumber; + isHex := False; + idx1 := Run; + Inc(Run); + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Succ(Run)] = '.' then + Break; + 'a'..'f', 'A'..'F': + if not isHex then + Break; + 'x', 'X': + begin + if (FLine[idx1] <> '0') or (Run > Succ(idx1)) then + Break; + if not IsHexChar(Succ(Run)) then + Break; + isHex := True; + end; + end; + Inc(Run); + end; +end; + +procedure TSynWebIDLSyn.QuestionMarkProc; +begin + Inc(Run); + fTokenID := tkSymbol; + fSymbolTokenID := stkQuestionMark; +end; + +procedure TSynWebIDLSyn.CRProc; +begin + fTokenID := tkSpace; + inc(Run); + if fLine[Run] = #10 then + inc(Run); +end; + +procedure TSynWebIDLSyn.GreaterProc; +begin + Inc(Run); + fTokenId := tkSymbol; + fSymbolTokenID := stkGreater; +end; + +procedure TSynWebIDLSyn.LessProc; +begin + Inc(Run); + fTokenId := tkSymbol; + fSymbolTokenID := stkLess; +end; + +procedure TSynWebIDLSyn.LFProc; +begin + fTokenID := tkSpace; + inc(Run); +end; + +procedure TSynWebIDLSyn.SlashProc; +begin + Inc(Run); + case fLine[Run] of + '/': + begin + repeat + Inc(Run); + until IsLineEnd(Run); + fRange := rsSingleComment; + fTokenID := tkComment; + end; + '*': + begin + Inc(Run, 1); + fRange := rsCStyleComment; + fTokenID := tkComment; + end + else + fTokenID := tkIdentifier; + end; +end; + +procedure TSynWebIDLSyn.CStyleCommentProc; +begin + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + fTokenID := tkComment; + repeat + if (fLine[Run] = '*') and + (fLine[Run + 1] = '/') then + begin + Inc(Run, 2); + fRange := rsUnKnown; + Break; + end; + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynWebIDLSyn.StringOpenProc; +begin + Inc(Run); + fRange := rsString; + fTokenID := tkString; +end; + +procedure TSynWebIDLSyn.StringProc; +begin + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + fTokenID := tkString; + repeat + if (fLine[Run] = '"') then + begin + Inc(Run, 1); + fRange := rsUnKnown; + Break; + end; + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynWebIDLSyn.IdentProc; +begin + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do + Inc(Run); +end; + +procedure TSynWebIDLSyn.BraceOpenProc; +begin + Inc(Run); + fTokenId := tkSymbol; + fSymbolTokenID := stkBraceOpen; +end; + +procedure TSynWebIDLSyn.BraceCloseProc; +begin + Inc(Run); + fTokenId := tkSymbol; + fSymbolTokenID := stkBraceClose; +end; + +procedure TSynWebIDLSyn.SquareOpenProc; +begin + Inc(Run); + fTokenID := tkSymbol; + fSymbolTokenID := stkSquareOpen; + fRange := rsExtendedAttributes; +end; + +procedure TSynWebIDLSyn.SquareCloseProc; +begin + Inc(Run); + fTokenID := tkSymbol; + fSymbolTokenID := stkSquareClose; + fRange := rsUnknown +end; + +procedure TSynWebIDLSyn.UnknownProc; +begin + inc(Run); + fTokenID := tkUnknown; +end; + +procedure TSynWebIDLSyn.Next; +begin + fTokenPos := Run; + case fRange of + rsCStyleComment: CStyleCommentProc; + rsString: StringProc; + else + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + '/': SlashProc; + '"': StringOpenProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '0'..'9': NumberProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '{': BraceOpenProc; + '}': BraceCloseProc; + ']': SquareCloseProc; + '[': SquareOpenProc; + '?': QuestionMarkProc; + ':': ColonProc; + '>': GreaterProc; + '<': LessProc; + else + UnknownProc; + end; + end; + inherited; +end; + +function TSynWebIDLSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; + else + Result := nil; + end; +end; + +function TSynWebIDLSyn.GetEol: Boolean; +begin + Result := Run = fLineLen + 1; +end; + +function TSynWebIDLSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +begin + Result := + 'any,attribute,boolean,byte,ByteString,callback,const,creator,Date,del' + + 'eter,dictionary,DOMString,double,enum,exception,float,getter,implement' + + 's,inherit,interface,legacycaller,long,object,octet,optional,partial,re' + + 'adonly,RegExp,sequence,setter,short,static,stringifier,typedef,unresti' + + 'cted,unrestricted,unsigned,void'; +end; + +function TSynWebIDLSyn.GetTokenID: TtkTokenKind; +begin + Result := fTokenId; + if (fRange = rsExtendedAttributes) and not ((fTokenID = tkSymbol) and + (fSymbolTokenID = stkSquareOpen)) then + Result := tkExtendedAttributes; +end; + +function TSynWebIDLSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkArguments: Result := fArgumentsAttri; + tkComment: Result := fCommentAttri; + tkExtendedAttributes: Result := fExtendedAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkTypes: Result := fTypesAttri; + tkUnknown: Result := fIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynWebIDLSyn.GetTokenKind: Integer; +begin + Result := Ord(fTokenId); +end; + +function TSynWebIDLSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', '0'..'9', 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; +end; + +function TSynWebIDLSyn.GetSampleSource: UnicodeString; +begin + Result := + '/* WEB IDL sample source */'#13#10 + + '[Constructor]'#13#10 + + 'interface GraphicalWindow {'#13#10 + + ' readonly attribute unsigned long width;'#13#10 + + ' readonly attribute unsigned long height;'#13#10 + + #13#10 + + ' attribute Paint currentPaint;'#13#10 + + #13#10 + + ' void drawRectangle(float x, float y, float width, float height);' + + #13#10#13#10 + + ' void drawText(float x, float y, DOMString text);'#13#10 + + '};'; +end; + +function TSynWebIDLSyn.IsFilterStored: Boolean; +begin + Result := fDefaultFilter <> SYNS_FilterWebIDL; +end; + +class function TSynWebIDLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangWebIDL; +end; + +class function TSynWebIDLSyn.GetLanguageName: string; +begin + Result := SYNS_LangWebIDL; +end; + +procedure TSynWebIDLSyn.ResetRange; +begin + fRange := rsUnknown; +end; + +procedure TSynWebIDLSyn.SetRange(Value: Pointer); +begin + fRange := TRangeState(Value); +end; + +function TSynWebIDLSyn.GetRange: Pointer; +begin + Result := Pointer(fRange); +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynWebIDLSyn); +{$ENDIF} +end. diff --git a/components/synedit/Source/SynMemo.pas b/components/synedit/Source/SynMemo.pas index f9b082ca..cf7fdcbe 100644 --- a/components/synedit/Source/SynMemo.pas +++ b/components/synedit/Source/SynMemo.pas @@ -205,6 +205,9 @@ type implementation uses +{$IFDEF SYN_COMPILER_18_UP} + AnsiStrings, +{$ENDIF} {$IFDEF UNICODE} WideStrUtils, {$ENDIF} @@ -267,7 +270,7 @@ begin if IsWindowUnicode(Handle) then WStrLCopy(PWideChar(Message.lParam), PWideChar(SelText), Length(SelText)) else - StrLCopy(PAnsiChar(Message.lParam), PAnsiChar(AnsiString(SelText)), Length(SelText)); + {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(PAnsiChar(Message.lParam), PAnsiChar(AnsiString(SelText)), Length(SelText)); Message.Result := Length(SelText); end; end; @@ -336,8 +339,8 @@ begin begin DestAnsi := PAnsiChar(Message.LParam); SourceAnsi := PAnsiChar(AnsiString(Lines[Message.WParam])); - StrLCopy(DestAnsi, SourceAnsi, PWord(Message.LParam)^); - Message.Result := StrLen(DestAnsi); + {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(DestAnsi, SourceAnsi, PWord(Message.LParam)^); + Message.Result := {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLen(DestAnsi); end end else diff --git a/components/synedit/Source/SynRegExpr.pas b/components/synedit/Source/SynRegExpr.pas index 00097008..e528b638 100644 --- a/components/synedit/Source/SynRegExpr.pas +++ b/components/synedit/Source/SynRegExpr.pas @@ -1296,7 +1296,9 @@ var AModifiersInt : integer) : boolean; begin Result := true; IsOn := true; +{$IFDEF CPUX86} Mask := 0; // prevent compiler warning +{$ENDIF} for i := 1 to length (AModifiers) do if AModifiers [i] = '-' then IsOn := false diff --git a/components/synedit/Source/SynUnicode.pas b/components/synedit/Source/SynUnicode.pas index 741ee0d4..603e0957 100644 --- a/components/synedit/Source/SynUnicode.pas +++ b/components/synedit/Source/SynUnicode.pas @@ -3162,7 +3162,7 @@ var if (Length(BOM) <> Length(UTF8BOM)) or not CompareMem(@BOM[0], @UTF8BOM[0], Length(UTF8BOM)) then - Stream.Seek(-Length(BOM), soFromCurrent) + Stream.Seek(-Length(BOM), soCurrent) else Result := True; end; @@ -3173,7 +3173,7 @@ var if (Length(BOM) <> Length(UTF16BOMLE)) or not CompareMem(@BOM[0], @UTF16BOMLE[0], Length(UTF16BOMLE)) then - Stream.Seek(-Length(BOM), soFromCurrent) + Stream.Seek(-Length(BOM), soCurrent) else Result := True; end; @@ -3184,7 +3184,7 @@ var if (Length(BOM) <> Length(UTF16BOMBE)) or not CompareMem(@BOM[0], @UTF16BOMBE[0], Length(UTF16BOMBE)) then - Stream.Seek(-Length(BOM), soFromCurrent) + Stream.Seek(-Length(BOM), soCurrent) else Result := True; end;